@ozdao/prometheus-framework 0.1.29 โ 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/BackofficeGallery-02c9721b.mjs +304 -0
- package/dist/BackofficeGallery-1d117a40.js +1 -0
- package/dist/BackofficeReports-cb4b180d.mjs +44 -0
- package/dist/BackofficeReports-d021871f.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-505c3ca5.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-b1873cb7.mjs +1945 -0
- package/dist/Button-2ca405bd.js +1 -0
- package/dist/Button-c59d387c.mjs +283 -0
- package/dist/Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js +1 -0
- package/dist/Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs +1 -0
- package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-0ea8fbf8.js +1 -0
- package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-4ed993c7.mjs +1 -0
- package/dist/CardOrganization-18c1e3fa.mjs +297 -0
- package/dist/CardOrganization-7d679e75.js +1 -0
- package/dist/Chips-2ada5eda.mjs +200 -0
- package/dist/Chips-8d0a1d2c.js +1 -0
- package/dist/Dashboard-239fb7a6.mjs +52 -0
- package/dist/Dashboard-94267906.js +1 -0
- package/dist/EULA-8265b0cf.mjs +4218 -0
- package/dist/EULA-cbb27503.js +1 -0
- package/dist/Feed-66095e66.js +1 -0
- package/dist/Feed-76fc4475.mjs +383 -0
- package/dist/Feed-e55bc6fa.js +1 -0
- package/dist/Feed-ef6c6ca3.mjs +371 -0
- package/dist/IconEdit-c98d3d06.mjs +339 -0
- package/dist/IconEdit-e4d0cc6e.js +1 -0
- package/dist/Image-052a3cc2.mjs +480 -0
- package/dist/Image-c90ee624.js +9 -0
- package/dist/MenuItem-0b249b94.mjs +93 -0
- package/dist/MenuItem-8b70d2cf.js +1 -0
- package/dist/Product-4b58701f.js +7 -0
- package/dist/Product-a6251018.mjs +844 -0
- package/dist/ProductEdit-3ff2af92.js +1 -0
- package/dist/ProductEdit-f901314c.mjs +306 -0
- package/dist/ProfileBlogposts-57931834.mjs +70 -0
- package/dist/ProfileBlogposts-af88ce98.js +1 -0
- package/dist/ProfileEvents-588eadf9.js +1 -0
- package/dist/ProfileEvents-ed7f9603.mjs +62 -0
- package/dist/ProfileOrganizations-7911deec.mjs +219 -0
- package/dist/ProfileOrganizations-ae258581.js +1 -0
- package/dist/Publics-50c0ff6c.js +1 -0
- package/dist/Publics-f34131bf.mjs +45 -0
- package/dist/Select-11ddabf5.mjs +79 -0
- package/dist/Select-3ca5ab39.js +1 -0
- package/dist/Socials-3fe01af1.mjs +275 -0
- package/dist/Socials-b19d0cb1.js +1 -0
- package/dist/addMembersQuantity-ea216f92.mjs +85 -0
- package/dist/addMembersQuantity-f922d82b.js +84 -0
- package/dist/auth-98fe3efb.mjs +612 -0
- package/dist/auth-acbe3ae1.js +7 -0
- package/dist/auth.client.cjs +7 -8
- package/dist/auth.client.js +449 -441
- package/dist/auth.validation-495e9d6d.js +1 -0
- package/dist/auth.validation-e265b496.mjs +23 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +55 -28
- package/dist/click-outside-0b0727d1.js +2 -0
- package/dist/click-outside-6101836c.mjs +19 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +121 -121
- package/dist/community.server.js +35 -5
- package/dist/community.server.mjs +35 -5
- package/dist/components/Button/Button.vue.d.ts +3 -0
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/CardHeader/CardHeader.vue.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/Field/Field.vue.d.ts +1 -1
- package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
- package/dist/components/Popup/Popup.vue.d.ts +2 -1
- package/dist/components/Popup/Popup.vue.d.ts.map +1 -1
- package/dist/components/Select/Select.vue.d.ts +1 -1
- package/dist/components/Select/Select.vue.d.ts.map +1 -1
- package/dist/components/Upload/Upload.vue.d.ts +1 -1
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +219 -217
- package/dist/events.server.js +2 -9
- package/dist/events.server.mjs +2 -9
- package/dist/legal.client.cjs +1 -1
- package/dist/legal.client.js +2565 -2545
- package/dist/main.css +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/modules/backoffice/components/pages/Dashboard.vue.d.ts +6 -0
- package/dist/modules/icons/navigation/IconCross.vue.d.ts +4 -0
- package/dist/modules/legal/components/pages/legal/EULA.vue.d.ts +2 -0
- package/dist/modules/organizations/components/elements/ButtonFollow.vue.d.ts +1 -1
- package/dist/modules/organizations/components/elements/ButtonToggleMembership.vue.d.ts +12 -0
- package/dist/modules/organizations/components/sections/DetailsTab.vue.d.ts +2 -58
- package/dist/modules/organizations/components/sections/Feed.vue.d.ts +1 -1
- package/dist/modules/reports/components/pages/BackofficeReports.vue.d.ts +2 -0
- package/dist/modules/reports/components/sections/FormReport.vue.d.ts +75 -0
- package/dist/modules/reports/store/reports.d.ts +41 -0
- package/dist/organizations-a241b21d.js +1 -0
- package/dist/organizations-ea9de495.mjs +122 -0
- package/dist/organizations.client-292e8444.js +3 -0
- package/dist/organizations.client-6fc91683.mjs +3072 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +51 -49
- package/dist/organizations.server.js +20 -28
- package/dist/organizations.server.mjs +20 -28
- package/dist/prometheus-framework.cjs.js +19 -19
- package/dist/prometheus-framework.es.js +1635 -1608
- package/dist/reports-270f69df.js +1 -0
- package/dist/reports-79cd9459.mjs +91 -0
- package/dist/reports.client.cjs +1 -0
- package/dist/reports.client.js +8 -0
- package/dist/reports.server.js +159 -0
- package/dist/reports.server.mjs +160 -0
- package/dist/states.validation-02ba0aee.js +1 -0
- package/dist/states.validation-e5f4fa3a.mjs +13 -0
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +286 -242
- package/dist/users.server.js +6 -18
- package/dist/users.server.mjs +6 -18
- package/package.json +9 -1
- package/src/components/Button/Button.vue +66 -60
- package/src/components/CardHeader/CardHeader.vue +51 -50
- package/src/components/Dropdown/Dropdown.vue +28 -12
- package/src/components/FieldPhone/click-outside.js +0 -48
- package/src/components/Popup/Popup.vue +74 -23
- package/src/components/Select/Select.vue +10 -6
- package/src/main.ts +1 -1
- package/src/modules/auth/components/pages/EnterPassword.vue +13 -1
- package/src/modules/auth/components/pages/SignIn.vue +7 -1
- package/src/modules/auth/router/auth.js +1 -1
- package/src/modules/auth/store/auth.js +1 -1
- package/src/modules/backoffice/components/layouts/Backoffice.vue +3 -3
- package/src/modules/backoffice/components/pages/Dashboard.vue +62 -0
- package/src/modules/backoffice/router/backoffice.js +26 -0
- package/src/modules/community/components/blocks/CardBlogpost.vue +3 -0
- package/src/modules/community/components/layouts/Community.vue +4 -4
- package/src/modules/community/components/pages/CreateBlogPost.vue +27 -28
- package/src/modules/community/components/sections/Comments.vue +4 -2
- package/src/modules/community/components/sections/Feed.vue +1 -1
- package/src/modules/community/controllers/blog.controller.js +22 -3
- package/src/modules/community/controllers/comments.controller.js +23 -5
- package/src/modules/events/components/blocks/CardEvent.vue +4 -0
- package/src/modules/events/components/pages/EditEvent.vue +27 -28
- package/src/modules/events/components/sections/Feed.vue +1 -1
- package/src/modules/events/controllers/events.controller.js +3 -10
- package/src/modules/gallery/components/sections/BackofficeGallery.vue +7 -23
- package/src/modules/icons/navigation/IconCross.vue +22 -0
- package/src/modules/legal/components/pages/Legal.vue +3 -0
- package/src/modules/legal/components/pages/legal/EULA.vue +2148 -0
- package/src/modules/legal/router/legal.js +11 -4
- package/src/modules/middlewares/client/auth.validation.js +14 -0
- package/src/modules/mobile/components/Menu/Menu.vue +1 -1
- package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
- package/src/modules/organizations/components/elements/ButtonFollow.vue +9 -7
- package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +101 -0
- package/src/modules/organizations/components/pages/Organization.vue +1 -34
- package/src/modules/organizations/components/sections/DetailsTab.vue +86 -8
- package/src/modules/organizations/controllers/memberships.controller.js +10 -7
- package/src/modules/organizations/controllers/organizations.controller.js +9 -20
- package/src/modules/organizations/controllers/utils/addMembersQuantity.js +21 -0
- package/src/modules/organizations/controllers/utils/addUserStatusFields.js +65 -0
- package/src/modules/organizations/controllers/utils/excludeBlockedMembers.js +18 -0
- package/src/modules/organizations/models/membership.model.js +5 -5
- package/src/modules/organizations/store/memberships.js +6 -6
- package/src/modules/organizations/store/organizations.js +0 -1
- package/src/modules/products/products.server.js +5 -0
- package/src/modules/reports/components/pages/BackofficeReports.vue +67 -0
- package/src/modules/reports/components/sections/FormReport.vue +114 -0
- package/src/modules/reports/controllers/reports.controller.js +67 -0
- package/src/modules/reports/models/report.model.js +58 -0
- package/src/modules/reports/reports.client.js +17 -0
- package/src/modules/reports/reports.server.js +13 -0
- package/src/modules/reports/routes/reports.routes.js +43 -0
- package/src/modules/reports/store/reports.js +118 -0
- package/src/modules/users/components/pages/Profile.vue +57 -10
- package/src/modules/users/controllers/users.controller.js +6 -19
- package/src/styles/base/all.scss +2 -0
- package/src/styles/layout.scss +39 -63
- package/src/styles/theme.scss +0 -1
- package/src/styles/components/popup.scss +0 -55
@@ -0,0 +1,67 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div class="flex-v-center flex-nowrap flex mn-medium">
|
4
|
+
<h3 class="mn-r-medium">Reports</h3> <!-- Updated this line -->
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="cols-3 gap-thin">
|
8
|
+
<div
|
9
|
+
v-for="report in state.all"
|
10
|
+
:key="report._id"
|
11
|
+
class="radius-medium pd-small bg-grey"
|
12
|
+
>
|
13
|
+
<!-- Here, you should update the properties of the report object to reflect the actual structure of a report -->
|
14
|
+
<!-- For example, I'm using 'user', 'type', and 'reason'. You should replace them with actual report properties -->
|
15
|
+
|
16
|
+
<p class="t-black p-small mn-small">
|
17
|
+
<span class="uppercase t-transp">User</span>
|
18
|
+
<br>
|
19
|
+
<span class="pd-2px radius-big d-inline-block bg-grey t-semi">{{report.user}}</span> <!-- Updated this line -->
|
20
|
+
</p>
|
21
|
+
|
22
|
+
<p class="t-black p-small mn-small">
|
23
|
+
<span class="uppercase t-transp">Type</span>
|
24
|
+
<br>
|
25
|
+
<span class="pd-2px radius-big d-inline-block bg-grey t-semi">{{report.type}}</span> <!-- Updated this line -->
|
26
|
+
</p>
|
27
|
+
|
28
|
+
<p class="t-black p-small mn-small">
|
29
|
+
<span class="uppercase t-transp">Reason</span>
|
30
|
+
<br>
|
31
|
+
<span class="pd-2px radius-big d-inline-block bg-grey t-semi">{{report.reason}}</span> <!-- Updated this line -->
|
32
|
+
</p>
|
33
|
+
|
34
|
+
<div class="gap-thin flex-nowrap flex">
|
35
|
+
<!-- Update buttons and actions as needed -->
|
36
|
+
<button class="button-small w-100 bg-black t-white button">
|
37
|
+
Close Report
|
38
|
+
</button>
|
39
|
+
<button class="button-small w-100 bg-black t-white button">
|
40
|
+
Hide Content
|
41
|
+
</button>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</template>
|
47
|
+
|
48
|
+
<script setup>
|
49
|
+
import { ref } from 'vue';
|
50
|
+
import { actions as reportActions, state } from '../../store/reports'; // Update the import path
|
51
|
+
|
52
|
+
// You might want to handle other lifecycle hooks or methods depending on your needs.
|
53
|
+
// Here, I'll demonstrate using the 'deleteReport' method as an example.
|
54
|
+
|
55
|
+
const deleteReport = async (id) => {
|
56
|
+
try {
|
57
|
+
await reportActions.remove({ _id: id }); // Updated method name and parameter
|
58
|
+
// Optionally, add a notification about successful deletion here
|
59
|
+
} catch (error) {
|
60
|
+
console.error(error);
|
61
|
+
// Optionally, add a notification about the error here
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
// Fetch all reports on component mount. This part depends on how your store is structured.
|
66
|
+
reportActions.read(); // Updated method name
|
67
|
+
</script>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
<template>
|
2
|
+
|
3
|
+
<div
|
4
|
+
@click.native="openReportPopup()"
|
5
|
+
>
|
6
|
+
<slot></slot>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<Popup
|
10
|
+
@close-popup="closeReportPopup"
|
11
|
+
:isPopupOpen="isReportPopup"
|
12
|
+
class="w-m-33r t-left pd-big bg-white radius-big"
|
13
|
+
>
|
14
|
+
<h3
|
15
|
+
class="mn-small"
|
16
|
+
>
|
17
|
+
Report Content
|
18
|
+
</h3>
|
19
|
+
|
20
|
+
<p
|
21
|
+
class="p-medium mn-small"
|
22
|
+
>
|
23
|
+
We strive to maintain a safe and comfortable environment for all users. If you encounter content that you believe violates our guidelines, please report it:
|
24
|
+
</p>
|
25
|
+
<Select
|
26
|
+
v-model:select="form.reason"
|
27
|
+
:options="[
|
28
|
+
'harassment',
|
29
|
+
'spam',
|
30
|
+
'inappropriate',
|
31
|
+
'misinformation',
|
32
|
+
'copyright',
|
33
|
+
'other'
|
34
|
+
]"
|
35
|
+
:placeholder="'Select reason'"
|
36
|
+
class="mn-small bg-white br-solid br-black-transp br-1px uppercase pd-medium t-semi bg-white t-black radius-medium"
|
37
|
+
/>
|
38
|
+
|
39
|
+
<p class="p-medium mn-small">Our moderators will review your report within 24 hours and take action if it violates our policies.</p>
|
40
|
+
|
41
|
+
<Button
|
42
|
+
:submit="onSubmit"
|
43
|
+
:callback="closeReportPopup"
|
44
|
+
class="w-100 bg-black t-white">
|
45
|
+
Report
|
46
|
+
</Button>
|
47
|
+
</Popup>
|
48
|
+
</template>
|
49
|
+
|
50
|
+
<script setup="props">
|
51
|
+
// Dependencies
|
52
|
+
import { computed,ref,reactive } from 'vue'
|
53
|
+
// Elements Import
|
54
|
+
import Popup from '@pf/src/components/Popup/Popup.vue';
|
55
|
+
import Button from '@pf/src/components/Button/Button.vue';
|
56
|
+
import Select from '@pf/src/components/Select/Select.vue';
|
57
|
+
// Store Import
|
58
|
+
import * as reports from '@pf/src/modules/reports/store/reports'
|
59
|
+
// ///////////////////////////////////////
|
60
|
+
// Components Props
|
61
|
+
// ///////////////////////////////////////
|
62
|
+
const props = defineProps({
|
63
|
+
user: {
|
64
|
+
type: String,
|
65
|
+
required: false
|
66
|
+
},
|
67
|
+
type: {
|
68
|
+
type: String,
|
69
|
+
required: false
|
70
|
+
},
|
71
|
+
reason: {
|
72
|
+
type: String,
|
73
|
+
required: false
|
74
|
+
},
|
75
|
+
target: {
|
76
|
+
type: String,
|
77
|
+
required: true
|
78
|
+
},
|
79
|
+
text: {
|
80
|
+
type: String,
|
81
|
+
default: '!'
|
82
|
+
},
|
83
|
+
status: {
|
84
|
+
type: String,
|
85
|
+
default: 'new'
|
86
|
+
}
|
87
|
+
})
|
88
|
+
// ///////////////////////////////////////
|
89
|
+
// Form Logic
|
90
|
+
// ///////////////////////////////////////
|
91
|
+
const form = reactive({
|
92
|
+
user: props.user,
|
93
|
+
type: props.type,
|
94
|
+
reason: props.reason,
|
95
|
+
target: props.target,
|
96
|
+
status: props.status,
|
97
|
+
})
|
98
|
+
|
99
|
+
function onSubmit () {
|
100
|
+
|
101
|
+
reports.actions.create(form)
|
102
|
+
}
|
103
|
+
// ///////////////////////////////////////
|
104
|
+
// Popup logic
|
105
|
+
// ///////////////////////////////////////
|
106
|
+
const isReportPopup = ref(false)
|
107
|
+
|
108
|
+
function openReportPopup() {
|
109
|
+
isReportPopup.value = true;
|
110
|
+
}
|
111
|
+
function closeReportPopup() {
|
112
|
+
isReportPopup.value = false;
|
113
|
+
}
|
114
|
+
</script>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
const controllerFactory = (db) => {
|
2
|
+
const Report = db.report;
|
3
|
+
|
4
|
+
const read = async (req, res) => {
|
5
|
+
try {
|
6
|
+
const reports = await Report.find({});
|
7
|
+
|
8
|
+
if (reports.length === 0) {
|
9
|
+
return res.status(404).json({ errorCode: "REPORTS_NOT_FOUND" });
|
10
|
+
}
|
11
|
+
res.status(200).json(reports);
|
12
|
+
} catch (err) {
|
13
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
const create = async (req, res) => {
|
18
|
+
const newReport = new Report(req.body);
|
19
|
+
|
20
|
+
try {
|
21
|
+
const savedReport = await newReport.save();
|
22
|
+
res.status(201).json(savedReport);
|
23
|
+
} catch (err) {
|
24
|
+
console.log(err)
|
25
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
const update = async (req, res) => {
|
30
|
+
const { _id } = req.body;
|
31
|
+
|
32
|
+
try {
|
33
|
+
const updatedReport = await Report.findOneAndUpdate({ _id }, req.body, { new: true, runValidators: true });
|
34
|
+
|
35
|
+
if (!updatedReport) {
|
36
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
37
|
+
}
|
38
|
+
res.status(200).json(updatedReport);
|
39
|
+
} catch (err) {
|
40
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
const deleteReport = async (req, res) => {
|
45
|
+
const { _id } = req.body;
|
46
|
+
|
47
|
+
try {
|
48
|
+
const report = await Report.findOneAndDelete({ _id });
|
49
|
+
|
50
|
+
if (!report) {
|
51
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
52
|
+
}
|
53
|
+
res.status(200).json({ message: "Report deleted successfully." });
|
54
|
+
} catch (err) {
|
55
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
56
|
+
}
|
57
|
+
};
|
58
|
+
|
59
|
+
return {
|
60
|
+
read,
|
61
|
+
create,
|
62
|
+
update,
|
63
|
+
delete: deleteReport,
|
64
|
+
};
|
65
|
+
};
|
66
|
+
|
67
|
+
module.exports = controllerFactory;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module.exports = (mongoose) => {
|
2
|
+
const ReportSchema = new mongoose.Schema({
|
3
|
+
status: {
|
4
|
+
type: String,
|
5
|
+
enum: [
|
6
|
+
'new',
|
7
|
+
'in progress',
|
8
|
+
'canceled',
|
9
|
+
'closed'
|
10
|
+
],
|
11
|
+
default: 'new'
|
12
|
+
},
|
13
|
+
user: {
|
14
|
+
type: String,
|
15
|
+
default: 'anonymous',
|
16
|
+
required: true
|
17
|
+
},
|
18
|
+
type: {
|
19
|
+
type: String,
|
20
|
+
enum: [
|
21
|
+
'user',
|
22
|
+
'organization',
|
23
|
+
'blogpost',
|
24
|
+
'event',
|
25
|
+
'comment'
|
26
|
+
],
|
27
|
+
default: 'spam',
|
28
|
+
required: true,
|
29
|
+
},
|
30
|
+
reason: {
|
31
|
+
type: String,
|
32
|
+
enum: [
|
33
|
+
'spam',
|
34
|
+
'harassment',
|
35
|
+
'inappropriate',
|
36
|
+
'misinformation',
|
37
|
+
'copyright',
|
38
|
+
'other'
|
39
|
+
],
|
40
|
+
default: 'spam',
|
41
|
+
required: true,
|
42
|
+
},
|
43
|
+
target: { // ะทะฐะผะตะฝัะตะผ 'organization' ะฝะฐ 'target', ัะฐะบ ะบะฐะบ ััะพ ะผะพะถะตั ะฑััั ะธะปะธ User, ะธะปะธ Organization
|
44
|
+
type: mongoose.Schema.Types.ObjectId,
|
45
|
+
ref: function (value) {
|
46
|
+
if (this.type === 'user') return 'User';
|
47
|
+
if (this.type === 'organization') return 'Organization';
|
48
|
+
},
|
49
|
+
required: true,
|
50
|
+
}
|
51
|
+
}, {
|
52
|
+
timestamps: { currentTime: () => Date.now() }
|
53
|
+
});
|
54
|
+
|
55
|
+
const Report = mongoose.model("Report", ReportSchema);
|
56
|
+
|
57
|
+
return Report;
|
58
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// Importing Vue components from the components directory
|
2
|
+
// import Profile from './components/pages/Profile.vue';
|
3
|
+
// import ProfileEdit from './components/pages/ProfileEdit.vue';
|
4
|
+
|
5
|
+
// Importing Vuex store modules from the store directory
|
6
|
+
import * as reportsStore from './store/reports.js';
|
7
|
+
|
8
|
+
// Importing Vue Router routes from the router directory
|
9
|
+
// import usersRoutes from './router/reports.js';
|
10
|
+
|
11
|
+
// Exporting components, store modules, and routes
|
12
|
+
export {
|
13
|
+
// Profile,
|
14
|
+
// ProfileEdit,
|
15
|
+
reportsStore,
|
16
|
+
// usersRoutes
|
17
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Importing controllers from the controllers directory
|
2
|
+
const reportsController = require('./controllers/reports.controller.js');
|
3
|
+
// Importing routes from the routes directory
|
4
|
+
const reportsRoutes = require('./routes/reports.routes.js');
|
5
|
+
// Models
|
6
|
+
const ReportModel = require('./models/report.model.js');
|
7
|
+
|
8
|
+
// Exporting controllers, routes, and models
|
9
|
+
module.exports = {
|
10
|
+
reportsController,
|
11
|
+
reportsRoutes,
|
12
|
+
ReportModel
|
13
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
const controllerFactory = require("../controllers/reports.controller");
|
2
|
+
// Middlewares
|
3
|
+
const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
|
4
|
+
|
5
|
+
module.exports = function(app, db, origins) {
|
6
|
+
const controller = controllerFactory(db);
|
7
|
+
|
8
|
+
const { authJwt } = middlewareFactoryGlobal(db);
|
9
|
+
|
10
|
+
app.use(function(req, res, next) {
|
11
|
+
|
12
|
+
const origin = req.headers.origin;
|
13
|
+
|
14
|
+
if (origins.includes(origin)) {
|
15
|
+
res.setHeader('Access-Control-Allow-Origin', origin);
|
16
|
+
}
|
17
|
+
|
18
|
+
res.header("Access-Control-Allow-Headers", "x-access-token, Origin, Content-Type, Accept");
|
19
|
+
|
20
|
+
next();
|
21
|
+
});
|
22
|
+
|
23
|
+
app.get(
|
24
|
+
"/reports",
|
25
|
+
controller.read
|
26
|
+
);
|
27
|
+
|
28
|
+
app.post(
|
29
|
+
"/reports",
|
30
|
+
controller.create
|
31
|
+
);
|
32
|
+
|
33
|
+
app.post(
|
34
|
+
"/reports",
|
35
|
+
controller.update
|
36
|
+
);
|
37
|
+
|
38
|
+
app.post(
|
39
|
+
"/reports",
|
40
|
+
controller.delete
|
41
|
+
);
|
42
|
+
};
|
43
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import { reactive, computed, watch } from "vue";
|
2
|
+
import { setError } from '@pf/src/modules/globals/store/globals'
|
3
|
+
import axios from 'axios';
|
4
|
+
|
5
|
+
const $axios = axios.create({baseURL: process.env.API_URL})
|
6
|
+
|
7
|
+
const state = reactive({
|
8
|
+
all: [],
|
9
|
+
current: {
|
10
|
+
_id: '',
|
11
|
+
status: '',
|
12
|
+
user: '',
|
13
|
+
type: '',
|
14
|
+
reason: '',
|
15
|
+
target: ''
|
16
|
+
},
|
17
|
+
form: {
|
18
|
+
isOpen: false,
|
19
|
+
status: '',
|
20
|
+
user: '',
|
21
|
+
type: '',
|
22
|
+
reason: '',
|
23
|
+
target: ''
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
// ะะตะนััะฒะธั, ะพัะฝะพัััะธะตัั ะบ ะฐัะธะฝั
ัะพะฝะฝัะผ ะพะฟะตัะฐัะธัะผ
|
28
|
+
const actions = {
|
29
|
+
async read() {
|
30
|
+
try {
|
31
|
+
const response = await $axios.get(`/reports`);
|
32
|
+
mutations.setAll(response.data);
|
33
|
+
return response.data;
|
34
|
+
} catch (error) {
|
35
|
+
setError(error);
|
36
|
+
throw error;
|
37
|
+
}
|
38
|
+
},
|
39
|
+
async create(report) {
|
40
|
+
try {
|
41
|
+
console.log(report)
|
42
|
+
const response = await $axios.post('/reports', report);
|
43
|
+
return response.data;
|
44
|
+
} catch (error) {
|
45
|
+
setError(error);
|
46
|
+
throw error;
|
47
|
+
}
|
48
|
+
},
|
49
|
+
|
50
|
+
async update(report) {
|
51
|
+
try {
|
52
|
+
const response = await $axios.put('/reports/' + report._id, report);
|
53
|
+
mutations.updateReportInAll(response.data);
|
54
|
+
return response.data;
|
55
|
+
} catch (error) {
|
56
|
+
setError(error);
|
57
|
+
throw error;
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
async remove(report) {
|
62
|
+
try {
|
63
|
+
const response = await $axios.delete('/reports/' + report._id);
|
64
|
+
mutations.removeReportFromAll(report._id);
|
65
|
+
return response.data;
|
66
|
+
} catch (error) {
|
67
|
+
setError(error);
|
68
|
+
throw error;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
const mutations = {
|
74
|
+
setAll(reports) {
|
75
|
+
state.all = reports;
|
76
|
+
},
|
77
|
+
|
78
|
+
setCurrent(report) {
|
79
|
+
state.current = report;
|
80
|
+
},
|
81
|
+
|
82
|
+
updateReportInAll(updatedReport) {
|
83
|
+
const index = state.all.findIndex(r => r._id === updatedReport._id);
|
84
|
+
if (index !== -1) {
|
85
|
+
state.all[index] = updatedReport;
|
86
|
+
}
|
87
|
+
},
|
88
|
+
|
89
|
+
removeReportFromAll(reportId) {
|
90
|
+
const index = state.all.findIndex(r => r._id === reportId);
|
91
|
+
if (index !== -1) {
|
92
|
+
state.all.splice(index, 1);
|
93
|
+
}
|
94
|
+
},
|
95
|
+
|
96
|
+
toggleForm() {
|
97
|
+
state.form.isOpen = !state.form.isOpen;
|
98
|
+
state.form = {
|
99
|
+
status: '',
|
100
|
+
user: '',
|
101
|
+
type: '',
|
102
|
+
reason: '',
|
103
|
+
target: ''
|
104
|
+
}
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
const history = [];
|
109
|
+
|
110
|
+
history.push(state);
|
111
|
+
|
112
|
+
watch(state, (newState, oldState) => { history.push(newState); });
|
113
|
+
|
114
|
+
export {
|
115
|
+
state,
|
116
|
+
actions,
|
117
|
+
mutations
|
118
|
+
};
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
<template>
|
2
2
|
<div
|
3
|
+
v-if="show"
|
3
4
|
class="for-transition w-100"
|
4
5
|
>
|
5
6
|
<div
|
@@ -22,8 +23,48 @@ x<template>
|
|
22
23
|
/>
|
23
24
|
|
24
25
|
<section
|
26
|
+
|
25
27
|
class="flex-center flex flex-column t-center w-100 mn-semi radius-medium pd-medium bg-grey"
|
26
28
|
>
|
29
|
+
|
30
|
+
<Dropdown
|
31
|
+
v-if="route.params._id && route.params._id !== auth.state.user._id"
|
32
|
+
:label="'...'"
|
33
|
+
:align="'right'"
|
34
|
+
class="cursor-pointer pos-absolute pos-r-0 pos-t-0 pd-thin radius-extra "
|
35
|
+
>
|
36
|
+
<section
|
37
|
+
class="bg-black pd-thin radius-small"
|
38
|
+
>
|
39
|
+
<FormReport
|
40
|
+
:user="auth.state.user._id"
|
41
|
+
:type="'user'"
|
42
|
+
:target="users.state.current._id"
|
43
|
+
:text="'Report'"
|
44
|
+
class="w-100"
|
45
|
+
>
|
46
|
+
<button
|
47
|
+
class="w-100 bg-black br-solid br-1px br-white-transp-20 t-white button-small button"
|
48
|
+
>
|
49
|
+
Report
|
50
|
+
</button>
|
51
|
+
</FormReport>
|
52
|
+
|
53
|
+
<ButtonToggleMembership
|
54
|
+
v-if="auth.state.user._id"
|
55
|
+
:user="auth.state.user._id"
|
56
|
+
:type="'user'"
|
57
|
+
:role="'blocked'"
|
58
|
+
:target="users.state.current._id"
|
59
|
+
:status="users.state.current.isBlocked"
|
60
|
+
:text="{create: 'Block', remove: 'Unblock'}"
|
61
|
+
@updateMembership="event => handleMembershipUpdate(event, 'isBlocked')"
|
62
|
+
class="t-white mn-t-thin bg-red"
|
63
|
+
/>
|
64
|
+
</section>
|
65
|
+
</Dropdown>
|
66
|
+
|
67
|
+
|
27
68
|
<IconEdit
|
28
69
|
v-if="route.params._id === auth.state.user._id"
|
29
70
|
@click="$router.push({
|
@@ -80,17 +121,19 @@ x<template>
|
|
80
121
|
>
|
81
122
|
<!-- ๐ 3 212 likes ยท -->
|
82
123
|
<!-- ๐ฌ 342 comments ยท -->
|
83
|
-
๐จโ๐จโ๐งโ๐ง {{users.state.current.
|
124
|
+
๐จโ๐จโ๐งโ๐ง {{users.state.current.numberOfSubscribers}} followers
|
84
125
|
</p>
|
85
126
|
|
86
|
-
|
87
|
-
|
127
|
+
<ButtonToggleMembership
|
128
|
+
v-if="auth.state.user._id && route.params._id && route.params._id !== auth.state.user._id"
|
129
|
+
:user="auth.state.user._id"
|
88
130
|
:type="'user'"
|
89
|
-
|
90
|
-
:
|
91
|
-
:
|
131
|
+
:role="'subscriber'"
|
132
|
+
:target="users.state.current._id"
|
133
|
+
:status="users.state.current.isSubscriber"
|
134
|
+
:text="{create: 'Follow', remove: 'Unfollow'}"
|
135
|
+
@updateMembership="event => handleMembershipUpdate(event, 'isSubscriber', 'numberOfSubscribers')"
|
92
136
|
class="w-min mn-medium mn-r-auto mn-l-auto"
|
93
|
-
@updateMembership="handleMembershipUpdate"
|
94
137
|
/>
|
95
138
|
|
96
139
|
<h4
|
@@ -203,11 +246,15 @@ x<template>
|
|
203
246
|
// Import components
|
204
247
|
import Field from '@pf/src/components/Field/Field.vue'
|
205
248
|
import Button from '@pf/src/components/Button/Button.vue'
|
249
|
+
import Dropdown from "@pf/src/components/Dropdown/Dropdown.vue";
|
206
250
|
// Mobile Module
|
207
251
|
import Menu from '@pf/src/modules/mobile/components/Menu/Menu.vue'
|
208
252
|
import MenuItem from '@pf/src/modules/mobile/components/Menu/MenuItem.vue'
|
209
253
|
// Org Module
|
210
254
|
import ButtonFollow from '@pf/src/modules/organizations/components/elements/ButtonFollow.vue'
|
255
|
+
import ButtonToggleMembership from '@pf/src/modules/organizations/components/elements/ButtonToggleMembership.vue'
|
256
|
+
// Report Module
|
257
|
+
import FormReport from '@pf/src/modules/reports/components/sections/FormReport.vue'
|
211
258
|
// Community Module
|
212
259
|
import Activity from '@pf/src/modules/community/components/blocks/Activity.vue';
|
213
260
|
import Socials from '@pf/src/modules/organizations/components/blocks/Socials.vue'
|
@@ -239,8 +286,8 @@ onMounted(async () => {
|
|
239
286
|
show.value = true
|
240
287
|
})
|
241
288
|
|
242
|
-
const handleMembershipUpdate = ({ membership,
|
243
|
-
memberships.mutations.handleMembershipUpdate(users.state.current, membership,
|
289
|
+
const handleMembershipUpdate = ({ membership, status, target }, statusName, statusNumber) => {
|
290
|
+
memberships.mutations.handleMembershipUpdate(users.state.current, membership, status, target, statusName, statusNumber)
|
244
291
|
};
|
245
292
|
|
246
293
|
function logout () {
|
@@ -1,6 +1,9 @@
|
|
1
1
|
const { v4: uuidv4 } = require('uuid');
|
2
2
|
const ObjectId = require('mongoose').Types.ObjectId;
|
3
3
|
|
4
|
+
const addUserStatusFields = require('@pf/src/modules/organizations/controllers/utils/addUserStatusFields');
|
5
|
+
const addMembersQuantity = require('@pf/src/modules/organizations/controllers/utils/addMembersQuantity');
|
6
|
+
|
4
7
|
const controllerFactory = (db) => {
|
5
8
|
const User = db.user;
|
6
9
|
|
@@ -48,25 +51,9 @@ const controllerFactory = (db) => {
|
|
48
51
|
}
|
49
52
|
});
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
});
|
56
|
-
|
57
|
-
query.push({
|
58
|
-
$addFields: {
|
59
|
-
isMember: {
|
60
|
-
$cond: {
|
61
|
-
if: req.query.user,
|
62
|
-
then: {
|
63
|
-
$in: [ new ObjectId(req.query.user), "$memberships.user" ]
|
64
|
-
},
|
65
|
-
else: "$$REMOVE"
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
});
|
54
|
+
|
55
|
+
query.push(addMembersQuantity());
|
56
|
+
query.push(addUserStatusFields(req.query.user));
|
70
57
|
|
71
58
|
query.push({
|
72
59
|
$skip: skip
|
package/src/styles/base/all.scss
CHANGED