@ozdao/prometheus-framework 0.1.30 → 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 +435 -439
- 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 +6 -0
- 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 @@
|
|
1
|
+
"use strict";const c=require("vue"),s=require("./globals-928eb13c.js"),i=require("./index-b41aac19.js"),o=i.axios.create({baseURL:process.env.API_URL}),r=c.reactive({all:[],current:{_id:"",status:"",user:"",type:"",reason:"",target:""},form:{isOpen:!1,status:"",user:"",type:"",reason:"",target:""}}),l={async read(){try{const e=await o.get("/reports");return a.setAll(e.data),e.data}catch(e){throw s.setError(e),e}},async create(e){try{return console.log(e),(await o.post("/reports",e)).data}catch(t){throw s.setError(t),t}},async update(e){try{const t=await o.put("/reports/"+e._id,e);return a.updateReportInAll(t.data),t.data}catch(t){throw s.setError(t),t}},async remove(e){try{const t=await o.delete("/reports/"+e._id);return a.removeReportFromAll(e._id),t.data}catch(t){throw s.setError(t),t}}},a={setAll(e){r.all=e},setCurrent(e){r.current=e},updateReportInAll(e){const t=r.all.findIndex(n=>n._id===e._id);t!==-1&&(r.all[t]=e)},removeReportFromAll(e){const t=r.all.findIndex(n=>n._id===e);t!==-1&&r.all.splice(t,1)},toggleForm(){r.form.isOpen=!r.form.isOpen,r.form={status:"",user:"",type:"",reason:"",target:""}}};c.watch(r,(e,t)=>{});const d=Object.freeze(Object.defineProperty({__proto__:null,actions:l,mutations:a,state:r},Symbol.toStringTag,{value:"Module"}));exports.actions=l;exports.reports=d;exports.state=r;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import { reactive as l, watch as c } from "vue";
|
2
|
+
import { s as a } from "./globals-96ba60e4.mjs";
|
3
|
+
import { a as i } from "./index-a661083c.mjs";
|
4
|
+
const s = i.create({ baseURL: process.env.API_URL }), r = l({
|
5
|
+
all: [],
|
6
|
+
current: {
|
7
|
+
_id: "",
|
8
|
+
status: "",
|
9
|
+
user: "",
|
10
|
+
type: "",
|
11
|
+
reason: "",
|
12
|
+
target: ""
|
13
|
+
},
|
14
|
+
form: {
|
15
|
+
isOpen: !1,
|
16
|
+
status: "",
|
17
|
+
user: "",
|
18
|
+
type: "",
|
19
|
+
reason: "",
|
20
|
+
target: ""
|
21
|
+
}
|
22
|
+
}), p = {
|
23
|
+
async read() {
|
24
|
+
try {
|
25
|
+
const t = await s.get("/reports");
|
26
|
+
return o.setAll(t.data), t.data;
|
27
|
+
} catch (t) {
|
28
|
+
throw a(t), t;
|
29
|
+
}
|
30
|
+
},
|
31
|
+
async create(t) {
|
32
|
+
try {
|
33
|
+
return console.log(t), (await s.post("/reports", t)).data;
|
34
|
+
} catch (e) {
|
35
|
+
throw a(e), e;
|
36
|
+
}
|
37
|
+
},
|
38
|
+
async update(t) {
|
39
|
+
try {
|
40
|
+
const e = await s.put("/reports/" + t._id, t);
|
41
|
+
return o.updateReportInAll(e.data), e.data;
|
42
|
+
} catch (e) {
|
43
|
+
throw a(e), e;
|
44
|
+
}
|
45
|
+
},
|
46
|
+
async remove(t) {
|
47
|
+
try {
|
48
|
+
const e = await s.delete("/reports/" + t._id);
|
49
|
+
return o.removeReportFromAll(t._id), e.data;
|
50
|
+
} catch (e) {
|
51
|
+
throw a(e), e;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}, o = {
|
55
|
+
setAll(t) {
|
56
|
+
r.all = t;
|
57
|
+
},
|
58
|
+
setCurrent(t) {
|
59
|
+
r.current = t;
|
60
|
+
},
|
61
|
+
updateReportInAll(t) {
|
62
|
+
const e = r.all.findIndex((n) => n._id === t._id);
|
63
|
+
e !== -1 && (r.all[e] = t);
|
64
|
+
},
|
65
|
+
removeReportFromAll(t) {
|
66
|
+
const e = r.all.findIndex((n) => n._id === t);
|
67
|
+
e !== -1 && r.all.splice(e, 1);
|
68
|
+
},
|
69
|
+
toggleForm() {
|
70
|
+
r.form.isOpen = !r.form.isOpen, r.form = {
|
71
|
+
status: "",
|
72
|
+
user: "",
|
73
|
+
type: "",
|
74
|
+
reason: "",
|
75
|
+
target: ""
|
76
|
+
};
|
77
|
+
}
|
78
|
+
};
|
79
|
+
c(r, (t, e) => {
|
80
|
+
});
|
81
|
+
const f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
82
|
+
__proto__: null,
|
83
|
+
actions: p,
|
84
|
+
mutations: o,
|
85
|
+
state: r
|
86
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
87
|
+
export {
|
88
|
+
p as a,
|
89
|
+
f as r,
|
90
|
+
r as s
|
91
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./reports-270f69df.js");require("vue");require("./globals-928eb13c.js");require("vue-i18n");require("./index-b41aac19.js");exports.reportsStore=e.reports;
|
@@ -0,0 +1,159 @@
|
|
1
|
+
"use strict";
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers-3b53548e.js");
|
3
|
+
const index = require("./index-21dfdbd9.js");
|
4
|
+
require("jsonwebtoken");
|
5
|
+
require("mongodb");
|
6
|
+
const controllerFactory$1 = (db) => {
|
7
|
+
const Report = db.report;
|
8
|
+
const read = async (req, res) => {
|
9
|
+
try {
|
10
|
+
const reports = await Report.find({});
|
11
|
+
if (reports.length === 0) {
|
12
|
+
return res.status(404).json({ errorCode: "REPORTS_NOT_FOUND" });
|
13
|
+
}
|
14
|
+
res.status(200).json(reports);
|
15
|
+
} catch (err) {
|
16
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
17
|
+
}
|
18
|
+
};
|
19
|
+
const create = async (req, res) => {
|
20
|
+
const newReport = new Report(req.body);
|
21
|
+
try {
|
22
|
+
const savedReport = await newReport.save();
|
23
|
+
res.status(201).json(savedReport);
|
24
|
+
} catch (err) {
|
25
|
+
console.log(err);
|
26
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
27
|
+
}
|
28
|
+
};
|
29
|
+
const update = async (req, res) => {
|
30
|
+
const { _id } = req.body;
|
31
|
+
try {
|
32
|
+
const updatedReport = await Report.findOneAndUpdate({ _id }, req.body, { new: true, runValidators: true });
|
33
|
+
if (!updatedReport) {
|
34
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
35
|
+
}
|
36
|
+
res.status(200).json(updatedReport);
|
37
|
+
} catch (err) {
|
38
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
39
|
+
}
|
40
|
+
};
|
41
|
+
const deleteReport = async (req, res) => {
|
42
|
+
const { _id } = req.body;
|
43
|
+
try {
|
44
|
+
const report = await Report.findOneAndDelete({ _id });
|
45
|
+
if (!report) {
|
46
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
47
|
+
}
|
48
|
+
res.status(200).json({ message: "Report deleted successfully." });
|
49
|
+
} catch (err) {
|
50
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
51
|
+
}
|
52
|
+
};
|
53
|
+
return {
|
54
|
+
read,
|
55
|
+
create,
|
56
|
+
update,
|
57
|
+
delete: deleteReport
|
58
|
+
};
|
59
|
+
};
|
60
|
+
var reports_controller = controllerFactory$1;
|
61
|
+
const controllerFactory = reports_controller;
|
62
|
+
const middlewareFactoryGlobal = index.server;
|
63
|
+
var reports_routes = function(app, db, origins) {
|
64
|
+
const controller = controllerFactory(db);
|
65
|
+
middlewareFactoryGlobal(db);
|
66
|
+
app.use(function(req, res, next) {
|
67
|
+
const origin = req.headers.origin;
|
68
|
+
if (origins.includes(origin)) {
|
69
|
+
res.setHeader("Access-Control-Allow-Origin", origin);
|
70
|
+
}
|
71
|
+
res.header("Access-Control-Allow-Headers", "x-access-token, Origin, Content-Type, Accept");
|
72
|
+
next();
|
73
|
+
});
|
74
|
+
app.get(
|
75
|
+
"/reports",
|
76
|
+
controller.read
|
77
|
+
);
|
78
|
+
app.post(
|
79
|
+
"/reports",
|
80
|
+
controller.create
|
81
|
+
);
|
82
|
+
app.post(
|
83
|
+
"/reports",
|
84
|
+
controller.update
|
85
|
+
);
|
86
|
+
app.post(
|
87
|
+
"/reports",
|
88
|
+
controller.delete
|
89
|
+
);
|
90
|
+
};
|
91
|
+
var report_model = (mongoose) => {
|
92
|
+
const ReportSchema = new mongoose.Schema({
|
93
|
+
status: {
|
94
|
+
type: String,
|
95
|
+
enum: [
|
96
|
+
"new",
|
97
|
+
"in progress",
|
98
|
+
"canceled",
|
99
|
+
"closed"
|
100
|
+
],
|
101
|
+
default: "new"
|
102
|
+
},
|
103
|
+
user: {
|
104
|
+
type: String,
|
105
|
+
default: "anonymous",
|
106
|
+
required: true
|
107
|
+
},
|
108
|
+
type: {
|
109
|
+
type: String,
|
110
|
+
enum: [
|
111
|
+
"user",
|
112
|
+
"organization",
|
113
|
+
"blogpost",
|
114
|
+
"event",
|
115
|
+
"comment"
|
116
|
+
],
|
117
|
+
default: "spam",
|
118
|
+
required: true
|
119
|
+
},
|
120
|
+
reason: {
|
121
|
+
type: String,
|
122
|
+
enum: [
|
123
|
+
"spam",
|
124
|
+
"harassment",
|
125
|
+
"inappropriate",
|
126
|
+
"misinformation",
|
127
|
+
"copyright",
|
128
|
+
"other"
|
129
|
+
],
|
130
|
+
default: "spam",
|
131
|
+
required: true
|
132
|
+
},
|
133
|
+
target: {
|
134
|
+
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
135
|
+
type: mongoose.Schema.Types.ObjectId,
|
136
|
+
ref: function(value) {
|
137
|
+
if (this.type === "user")
|
138
|
+
return "User";
|
139
|
+
if (this.type === "organization")
|
140
|
+
return "Organization";
|
141
|
+
},
|
142
|
+
required: true
|
143
|
+
}
|
144
|
+
}, {
|
145
|
+
timestamps: { currentTime: () => Date.now() }
|
146
|
+
});
|
147
|
+
const Report = mongoose.model("Report", ReportSchema);
|
148
|
+
return Report;
|
149
|
+
};
|
150
|
+
const reportsController = reports_controller;
|
151
|
+
const reportsRoutes = reports_routes;
|
152
|
+
const ReportModel = report_model;
|
153
|
+
var reports_server = {
|
154
|
+
reportsController,
|
155
|
+
reportsRoutes,
|
156
|
+
ReportModel
|
157
|
+
};
|
158
|
+
const reports_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(reports_server);
|
159
|
+
module.exports = reports_server$1;
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-83b1d755.mjs";
|
2
|
+
import { s as server } from "./index-fa8d5df4.mjs";
|
3
|
+
import "jsonwebtoken";
|
4
|
+
import "mongodb";
|
5
|
+
const controllerFactory$1 = (db) => {
|
6
|
+
const Report = db.report;
|
7
|
+
const read = async (req, res) => {
|
8
|
+
try {
|
9
|
+
const reports = await Report.find({});
|
10
|
+
if (reports.length === 0) {
|
11
|
+
return res.status(404).json({ errorCode: "REPORTS_NOT_FOUND" });
|
12
|
+
}
|
13
|
+
res.status(200).json(reports);
|
14
|
+
} catch (err) {
|
15
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
16
|
+
}
|
17
|
+
};
|
18
|
+
const create = async (req, res) => {
|
19
|
+
const newReport = new Report(req.body);
|
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
|
+
const update = async (req, res) => {
|
29
|
+
const { _id } = req.body;
|
30
|
+
try {
|
31
|
+
const updatedReport = await Report.findOneAndUpdate({ _id }, req.body, { new: true, runValidators: true });
|
32
|
+
if (!updatedReport) {
|
33
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
34
|
+
}
|
35
|
+
res.status(200).json(updatedReport);
|
36
|
+
} catch (err) {
|
37
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
38
|
+
}
|
39
|
+
};
|
40
|
+
const deleteReport = async (req, res) => {
|
41
|
+
const { _id } = req.body;
|
42
|
+
try {
|
43
|
+
const report = await Report.findOneAndDelete({ _id });
|
44
|
+
if (!report) {
|
45
|
+
return res.status(404).json({ errorCode: "REPORT_NOT_FOUND" });
|
46
|
+
}
|
47
|
+
res.status(200).json({ message: "Report deleted successfully." });
|
48
|
+
} catch (err) {
|
49
|
+
res.status(500).json({ errorCode: "INTERNAL_SERVER_ERROR", message: err.message });
|
50
|
+
}
|
51
|
+
};
|
52
|
+
return {
|
53
|
+
read,
|
54
|
+
create,
|
55
|
+
update,
|
56
|
+
delete: deleteReport
|
57
|
+
};
|
58
|
+
};
|
59
|
+
var reports_controller = controllerFactory$1;
|
60
|
+
const controllerFactory = reports_controller;
|
61
|
+
const middlewareFactoryGlobal = server;
|
62
|
+
var reports_routes = function(app, db, origins) {
|
63
|
+
const controller = controllerFactory(db);
|
64
|
+
middlewareFactoryGlobal(db);
|
65
|
+
app.use(function(req, res, next) {
|
66
|
+
const origin = req.headers.origin;
|
67
|
+
if (origins.includes(origin)) {
|
68
|
+
res.setHeader("Access-Control-Allow-Origin", origin);
|
69
|
+
}
|
70
|
+
res.header("Access-Control-Allow-Headers", "x-access-token, Origin, Content-Type, Accept");
|
71
|
+
next();
|
72
|
+
});
|
73
|
+
app.get(
|
74
|
+
"/reports",
|
75
|
+
controller.read
|
76
|
+
);
|
77
|
+
app.post(
|
78
|
+
"/reports",
|
79
|
+
controller.create
|
80
|
+
);
|
81
|
+
app.post(
|
82
|
+
"/reports",
|
83
|
+
controller.update
|
84
|
+
);
|
85
|
+
app.post(
|
86
|
+
"/reports",
|
87
|
+
controller.delete
|
88
|
+
);
|
89
|
+
};
|
90
|
+
var report_model = (mongoose) => {
|
91
|
+
const ReportSchema = new mongoose.Schema({
|
92
|
+
status: {
|
93
|
+
type: String,
|
94
|
+
enum: [
|
95
|
+
"new",
|
96
|
+
"in progress",
|
97
|
+
"canceled",
|
98
|
+
"closed"
|
99
|
+
],
|
100
|
+
default: "new"
|
101
|
+
},
|
102
|
+
user: {
|
103
|
+
type: String,
|
104
|
+
default: "anonymous",
|
105
|
+
required: true
|
106
|
+
},
|
107
|
+
type: {
|
108
|
+
type: String,
|
109
|
+
enum: [
|
110
|
+
"user",
|
111
|
+
"organization",
|
112
|
+
"blogpost",
|
113
|
+
"event",
|
114
|
+
"comment"
|
115
|
+
],
|
116
|
+
default: "spam",
|
117
|
+
required: true
|
118
|
+
},
|
119
|
+
reason: {
|
120
|
+
type: String,
|
121
|
+
enum: [
|
122
|
+
"spam",
|
123
|
+
"harassment",
|
124
|
+
"inappropriate",
|
125
|
+
"misinformation",
|
126
|
+
"copyright",
|
127
|
+
"other"
|
128
|
+
],
|
129
|
+
default: "spam",
|
130
|
+
required: true
|
131
|
+
},
|
132
|
+
target: {
|
133
|
+
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
134
|
+
type: mongoose.Schema.Types.ObjectId,
|
135
|
+
ref: function(value) {
|
136
|
+
if (this.type === "user")
|
137
|
+
return "User";
|
138
|
+
if (this.type === "organization")
|
139
|
+
return "Organization";
|
140
|
+
},
|
141
|
+
required: true
|
142
|
+
}
|
143
|
+
}, {
|
144
|
+
timestamps: { currentTime: () => Date.now() }
|
145
|
+
});
|
146
|
+
const Report = mongoose.model("Report", ReportSchema);
|
147
|
+
return Report;
|
148
|
+
};
|
149
|
+
const reportsController = reports_controller;
|
150
|
+
const reportsRoutes = reports_routes;
|
151
|
+
const ReportModel = report_model;
|
152
|
+
var reports_server = {
|
153
|
+
reportsController,
|
154
|
+
reportsRoutes,
|
155
|
+
ReportModel
|
156
|
+
};
|
157
|
+
const reports_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(reports_server);
|
158
|
+
export {
|
159
|
+
reports_server$1 as default
|
160
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const u=require("vue-router"),e=require("./auth-acbe3ae1.js");u.useRouter();function o(t,r,s){s(),e.state.user.phone="",e.state.user.email="",e.state.user.password="",e.state.user.passwordRepeat=""}function a(t,r,s){console.log(e.state.user),e.state.user.phone===""&&e.state.user.email===""?s("/auth/signin"):s()}exports.checkUser=a;exports.resetUser=o;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { useRouter as t } from "vue-router";
|
2
|
+
import { s as e } from "./auth-98fe3efb.mjs";
|
3
|
+
t();
|
4
|
+
function i(r, o, s) {
|
5
|
+
s(), e.user.phone = "", e.user.email = "", e.user.password = "", e.user.passwordRepeat = "";
|
6
|
+
}
|
7
|
+
function m(r, o, s) {
|
8
|
+
console.log(e.user), e.user.phone === "" && e.user.email === "" ? s("/auth/signin") : s();
|
9
|
+
}
|
10
|
+
export {
|
11
|
+
m as c,
|
12
|
+
i as r
|
13
|
+
};
|