@ozdao/prometheus-framework 0.2.138 → 0.2.139
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +29 -14
- package/dist/auth.server.mjs +29 -14
- package/dist/community.server.js +3 -3
- package/dist/community.server.mjs +3 -3
- package/dist/events.server.js +3 -3
- package/dist/events.server.mjs +3 -3
- package/dist/files.server.js +3 -3
- package/dist/files.server.mjs +3 -3
- package/dist/gallery.server.js +4 -4
- package/dist/gallery.server.mjs +4 -4
- package/dist/index-DNI4aUP2.js +259 -0
- package/dist/index-Tcyehi73.mjs +260 -0
- package/dist/orders.server.js +9 -8
- package/dist/orders.server.mjs +9 -8
- package/dist/organizations.server.js +31 -15
- package/dist/organizations.server.mjs +31 -15
- package/dist/products.server.js +37 -5
- package/dist/products.server.mjs +37 -5
- package/dist/prometheus-framework/src/components/Completion/Completion.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Completion/Completion.vue.js +19 -19
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +32 -31
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/auth.js +50 -47
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.cjs +1 -1
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +14 -14
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +4 -4
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +41 -38
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +121 -112
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +15 -14
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +120 -60
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.js +25 -24
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +66 -67
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +78 -74
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
- package/dist/reports.server.js +0 -3
- package/dist/reports.server.mjs +0 -3
- package/dist/style.css +1 -1
- package/dist/wallet.server.js +5 -5
- package/dist/wallet.server.mjs +8 -8
- package/package.json +1 -1
- package/src/components/Completion/Completion.vue +29 -30
- package/src/modules/auth/components/pages/Invite.vue +4 -2
- package/src/modules/auth/controllers/auth.controller.js +30 -12
- package/src/modules/auth/middlewares/authJwt.js +80 -0
- package/src/modules/{middlewares/server → auth/middlewares}/index.js +1 -3
- package/src/modules/{middlewares/server → auth/middlewares}/verifyAccesses.js +1 -1
- package/src/modules/auth/routes/auth.routes.js +2 -2
- package/src/modules/auth/routes/twofa.routes.js +1 -1
- package/src/modules/auth/store/auth.js +9 -0
- package/src/modules/chats/routes/chats.routes.js +1 -1
- package/src/modules/community/routes/blog.routes.js +2 -2
- package/src/modules/events/routes/events.routes.js +2 -2
- package/src/modules/files/routes/files.routes.js +2 -2
- package/src/modules/gallery/routes/gallery.routes.js +4 -5
- package/src/modules/globals/services/globals.crud.js +2 -2
- package/src/modules/marketplace/store/marketplace.js +1 -1
- package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +2 -2
- package/src/modules/orders/components/sections/FormAddCustomer.vue +2 -2
- package/src/modules/orders/controllers/orders.controller.js +1 -0
- package/src/modules/orders/routes/applications.routes.js +2 -2
- package/src/modules/orders/routes/orders.routes.js +2 -2
- package/src/modules/organizations/components/blocks/CardOrganization.vue +9 -7
- package/src/modules/organizations/components/pages/Members.vue +26 -15
- package/src/modules/organizations/components/sections/DetailsTab.vue +1 -1
- package/src/modules/organizations/components/sections/MembersAdd.vue +101 -43
- package/src/modules/organizations/controllers/invites.controller.js +18 -13
- package/src/modules/organizations/controllers/memberships.controller.js +16 -9
- package/src/modules/organizations/controllers/organizations.controller.js +3 -4
- package/src/modules/organizations/models/membership.model.js +2 -0
- package/src/modules/organizations/models/organization.model.js +4 -0
- package/src/modules/organizations/routes/invites.routes.js +2 -2
- package/src/modules/organizations/store/invites.js +2 -1
- package/src/modules/products/controllers/leftovers.controller.js +1 -1
- package/src/modules/products/middlewares/index.js +11 -0
- package/src/modules/products/routes/categories.routes.js +2 -2
- package/src/modules/reports/routes/reports.routes.js +2 -2
- package/src/modules/spots/components/layouts/Spots.vue +2 -2
- package/src/modules/spots/components/pages/Map.vue +79 -78
- package/src/modules/users/components/pages/ProfileEdit.vue +37 -22
- package/src/modules/wallet/controllers/routes/payments.routes.js +2 -2
- package/src/modules/wallet/controllers/routes/rewards.routes.js +2 -2
- package/src/modules/middlewares/server/authJwt.js +0 -68
- /package/src/modules/{middlewares/server → auth/middlewares}/authSecret.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifyInvites.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifySignUp.js +0 -0
- /package/src/modules/{middlewares/server → auth/middlewares}/verifyUser.js +0 -0
- /package/src/modules/globals/services/{globals.cashe.js → globals.cache.js} +0 -0
- /package/src/modules/{middlewares/server → products/middlewares}/verifyCategory.js +0 -0
@@ -4,6 +4,7 @@ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils
|
|
4
4
|
|
5
5
|
const controllerFactory = (db) => {
|
6
6
|
const Membership = db.membership;
|
7
|
+
const Department = db.department;
|
7
8
|
|
8
9
|
const read = async (req, res) => {
|
9
10
|
try {
|
@@ -109,21 +110,27 @@ const controllerFactory = (db) => {
|
|
109
110
|
const deleteMembership = async (req, res) => {
|
110
111
|
const { _id, type, target, user, role } = req.body;
|
111
112
|
|
112
|
-
|
113
|
-
console.log(req.body)
|
114
|
-
|
115
113
|
try {
|
116
|
-
//
|
117
|
-
const membership = _id
|
114
|
+
// Обрабатываем сценарий когда мы не знаем _id нашего membership
|
115
|
+
const membership = _id
|
116
|
+
? await Membership.findOneAndDelete({ _id: new ObjectId(_id) })
|
117
|
+
: await Membership.findOneAndDelete({ type, target, user, role });
|
118
118
|
|
119
119
|
if (!membership) {
|
120
120
|
return res.status(404).send({ errorCode: 'MEMBERSHIP_NOT_FOUND' });
|
121
|
-
} else {
|
122
|
-
await Membership.deleteOne({ _id: membership._id });
|
123
|
-
res.status(200).send(membership);
|
124
121
|
}
|
122
|
+
|
123
|
+
// Удаление пользователя из departments
|
124
|
+
if (membership.type === 'organization') {
|
125
|
+
await Department.updateMany(
|
126
|
+
{ organization: target },
|
127
|
+
{ $pull: { members: { user: user } } }
|
128
|
+
);
|
129
|
+
}
|
130
|
+
|
131
|
+
res.status(200).send(membership);
|
125
132
|
} catch (error) {
|
126
|
-
console.log(error)
|
133
|
+
console.log(error);
|
127
134
|
res.status(500).send({ errorCode: 'SERVER_ERROR' });
|
128
135
|
}
|
129
136
|
};
|
@@ -27,7 +27,6 @@ const controllerFactory = (db) => {
|
|
27
27
|
const sort = {
|
28
28
|
...(sortParam === 'distance' ? { 'distanceExist': -1 } : {}),
|
29
29
|
[sortParam]: sortOrder === 'desc' ? -1 : 1,
|
30
|
-
'numberOfProducts': -1,
|
31
30
|
"_id": 1
|
32
31
|
};
|
33
32
|
console.log(sort)
|
@@ -140,7 +139,7 @@ const controllerFactory = (db) => {
|
|
140
139
|
}
|
141
140
|
|
142
141
|
// Determine the search radius based on the level of specificity
|
143
|
-
const radius = city ?
|
142
|
+
const radius = city ? 25 : state ? 50 : 250;
|
144
143
|
|
145
144
|
// Use MongoDB's $geoNear to find organizations within a certain radius
|
146
145
|
matchConditions.push({
|
@@ -185,9 +184,9 @@ const controllerFactory = (db) => {
|
|
185
184
|
if (locationRadius) {
|
186
185
|
radius = parseFloat(locationRadius) / earthRadiusKm;
|
187
186
|
} else if (city) {
|
188
|
-
radius =
|
187
|
+
radius = 25 / earthRadiusKm;
|
189
188
|
} else if (state) {
|
190
|
-
radius =
|
189
|
+
radius = 50 / earthRadiusKm;
|
191
190
|
} else {
|
192
191
|
radius = null
|
193
192
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/invites.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
5
5
|
// Routes
|
6
6
|
module.exports = function(app, db) {
|
7
7
|
const controller = controllerFactory(db);
|
8
|
-
const { verifyInvites } =
|
8
|
+
const { verifyInvites } = middlewareFactoryAuth(db);
|
9
9
|
|
10
10
|
// Get one invite
|
11
11
|
app.get(
|
@@ -38,7 +38,8 @@ const actions = {
|
|
38
38
|
},
|
39
39
|
async create(invites) {
|
40
40
|
try {
|
41
|
-
await $axios.post(`/api/invites/create`, invites);
|
41
|
+
const response = await $axios.post(`/api/invites/create`, invites);
|
42
|
+
return Promise.resolve(response.data);
|
42
43
|
state.error = null;
|
43
44
|
} catch (error) {
|
44
45
|
setError(error);
|
@@ -1,12 +1,12 @@
|
|
1
1
|
// Factories
|
2
2
|
const controllerFactory = require("../controllers/categories.controller");
|
3
3
|
// Middlewares
|
4
|
-
const
|
4
|
+
const middlewareFactoryProducts = require('@pf/src/modules/products/middlewares');
|
5
5
|
|
6
6
|
module.exports = function(app, db) {
|
7
7
|
const controller = controllerFactory(db);
|
8
8
|
|
9
|
-
const { verifyCategory } =
|
9
|
+
const { verifyCategory } = middlewareFactoryProducts(db);
|
10
10
|
// Get categorys
|
11
11
|
app.get(
|
12
12
|
"/categories",
|
@@ -1,11 +1,11 @@
|
|
1
1
|
const controllerFactory = require("../controllers/reports.controller");
|
2
2
|
// Middlewares
|
3
|
-
const middlewareFactoryGlobal = require('@pf/src/modules/middlewares
|
3
|
+
// const middlewareFactoryGlobal = require('@pf/src/modules/middlewares');
|
4
4
|
|
5
5
|
module.exports = function(app, db, origins) {
|
6
6
|
const controller = controllerFactory(db);
|
7
7
|
|
8
|
-
const { authJwt } = middlewareFactoryGlobal(db);
|
8
|
+
// const { authJwt } = middlewareFactoryGlobal(db);
|
9
9
|
|
10
10
|
app.get(
|
11
11
|
"/reports",
|
@@ -101,7 +101,7 @@
|
|
101
101
|
delivery: query.delivery ? query.delivery.split(',') : [],
|
102
102
|
// Продолжайте этот паттерн для остальных полей фильтра
|
103
103
|
};
|
104
|
-
marketplace.state.filter = newFilterValue;
|
104
|
+
marketplace.state.filter.selected = newFilterValue;
|
105
105
|
}
|
106
106
|
|
107
107
|
|
@@ -109,7 +109,7 @@
|
|
109
109
|
await categories.actions.fetchCategories()
|
110
110
|
})
|
111
111
|
|
112
|
-
watch(() => marketplace.state.filter, (newFilterValue, oldFilterValue) => {
|
112
|
+
watch(() => marketplace.state.filter.selected, (newFilterValue, oldFilterValue) => {
|
113
113
|
// Переводим фильтр в формат query
|
114
114
|
const query = { ...route.query };
|
115
115
|
|
@@ -89,106 +89,107 @@ onMounted(async () => {
|
|
89
89
|
|
90
90
|
// Определите уровень зума в зависимости от доступной информации
|
91
91
|
if (route.params.location || globals.state.position?.location) {
|
92
|
-
zoomLevel =
|
92
|
+
zoomLevel = 15;
|
93
93
|
} else if (route.params.country || globals.state.position?.country) {
|
94
94
|
zoomLevel = 9;
|
95
95
|
} else if (route.params.state || globals.state.position?.state) {
|
96
96
|
zoomLevel = 6;
|
97
97
|
} else if (route.params.city || globals.state.position?.city) {
|
98
|
-
zoomLevel =
|
98
|
+
zoomLevel = 14;
|
99
99
|
} else {
|
100
100
|
zoomLevel = 2;
|
101
101
|
}
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
103
|
+
const loader = new GMLoader({
|
104
|
+
apiKey: props.apiKey,
|
105
|
+
version: "weekly",
|
106
|
+
libraries: ["places"],
|
107
|
+
language: 'en'
|
108
|
+
});
|
108
109
|
|
109
|
-
|
110
|
-
country = await getCountry();
|
111
|
-
} catch {
|
112
|
-
country = 'Thailand'
|
113
|
-
console.log(error)
|
114
|
-
}
|
110
|
+
loader.load().then(async () => {
|
115
111
|
|
116
|
-
|
117
|
-
|
112
|
+
// Если координаты не заданы, попробуйте их получить
|
113
|
+
if (!lat || !lng) {
|
114
|
+
let country
|
118
115
|
|
119
|
-
|
116
|
+
const geocoder = new google.maps.Geocoder();
|
120
117
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
console.error('No results found for the country code.');
|
127
|
-
}
|
128
|
-
} catch (error) {
|
129
|
-
console.error('Error getting coordinates from country code:', error);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
// If there's no lat/lng in the query, try to use country/state/city to get the lat/lng
|
134
|
-
if (!lat && !lng && (route.params.country || route.params.state || route.params.city)) {
|
135
|
-
const geocoder = new google.maps.Geocoder();
|
136
|
-
|
137
|
-
const address = [
|
138
|
-
route.params.city,
|
139
|
-
route.params.state,
|
140
|
-
route.params.country
|
141
|
-
].filter(Boolean).join(', ');
|
142
|
-
|
143
|
-
try {
|
144
|
-
const results = await geocoder.geocode({ address });
|
145
|
-
|
146
|
-
if (results[0]) {
|
147
|
-
lat = results[0].geometry.location.lat();
|
148
|
-
lng = results[0].geometry.location.lng();
|
118
|
+
try {
|
119
|
+
country = await getCountry();
|
120
|
+
} catch {
|
121
|
+
country = 'Thailand'
|
122
|
+
console.log(error)
|
149
123
|
}
|
150
124
|
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
}
|
125
|
+
try {
|
126
|
+
const results = await geocoder.geocode({ 'address': country })
|
155
127
|
|
156
|
-
|
157
|
-
apiKey: props.apiKey,
|
158
|
-
version: "weekly",
|
159
|
-
libraries: ["places"],
|
160
|
-
language: 'en'
|
161
|
-
});
|
128
|
+
console.log(results);
|
162
129
|
|
163
|
-
|
130
|
+
if (results) {
|
131
|
+
lat = results.results[0].geometry.location.lat();
|
132
|
+
lng = results.results[0].geometry.location.lng();
|
133
|
+
zoomLevel = 6;
|
134
|
+
} else {
|
135
|
+
console.error('No results found for the country code.');
|
136
|
+
}
|
137
|
+
} catch (error) {
|
138
|
+
console.error('Error getting coordinates from country code:', error);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
// If there's no lat/lng in the query, try to use country/state/city to get the lat/lng
|
143
|
+
if (!lat && !lng && (route.params.country || route.params.state || route.params.city)) {
|
144
|
+
const geocoder = new google.maps.Geocoder();
|
145
|
+
|
146
|
+
const address = [
|
147
|
+
route.params.city,
|
148
|
+
route.params.state,
|
149
|
+
route.params.country
|
150
|
+
].filter(Boolean).join(', ');
|
151
|
+
|
152
|
+
try {
|
153
|
+
const results = await geocoder.geocode({ address });
|
154
|
+
|
155
|
+
if (results[0]) {
|
156
|
+
lat = results[0].geometry.location.lat();
|
157
|
+
lng = results[0].geometry.location.lng();
|
158
|
+
}
|
164
159
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
// categories: route.query.categories,
|
170
|
-
// prices: route.query.prices,
|
171
|
-
// delivery: route.query.delivery,
|
172
|
-
country: route.params.country,
|
173
|
-
state: route.params.state,
|
174
|
-
city: route.params.city,
|
175
|
-
categories: route.query.categories,
|
176
|
-
prices: route.query.prices,
|
177
|
-
delivery: route.query.delivery,
|
178
|
-
sortParam: route.query.sortParam || marketplace.state.sort.param,
|
179
|
-
sortOrder: route.query.sortOrder || marketplace.state.sort.order,
|
180
|
-
location: {coordinates: [lng,lat] },
|
181
|
-
locationRadius: 1000,
|
182
|
-
limit: 500,
|
183
|
-
};
|
160
|
+
} catch (error) {
|
161
|
+
console.error('Error getting coordinates:', error);
|
162
|
+
}
|
163
|
+
}
|
184
164
|
|
185
|
-
console.log(params)
|
186
165
|
|
187
|
-
|
166
|
+
skip.value += limit.value;
|
167
|
+
|
168
|
+
const params = {
|
169
|
+
// country: route.params.country,
|
170
|
+
// state: route.params.state,
|
171
|
+
// city: route.params.city,
|
172
|
+
// categories: route.query.categories,
|
173
|
+
// prices: route.query.prices,
|
174
|
+
// delivery: route.query.delivery,
|
175
|
+
country: route.params.country,
|
176
|
+
state: route.params.state,
|
177
|
+
city: route.params.city,
|
178
|
+
categories: route.query.categories,
|
179
|
+
prices: route.query.prices,
|
180
|
+
delivery: route.query.delivery,
|
181
|
+
sortParam: route.query.sortParam || marketplace.state.sort.param,
|
182
|
+
sortOrder: route.query.sortOrder || marketplace.state.sort.order,
|
183
|
+
location: {coordinates: [lng,lat] },
|
184
|
+
locationRadius: 1000,
|
185
|
+
limit: 500,
|
186
|
+
};
|
187
|
+
|
188
|
+
console.log(params)
|
188
189
|
|
189
|
-
|
190
|
+
const data = await actions.read(params);
|
190
191
|
|
191
|
-
|
192
|
+
state.all = [...state.all, ...data];
|
192
193
|
|
193
194
|
map.value = new google.maps.Map(document.getElementById('map'), {
|
194
195
|
mapTypeControl: false,
|
@@ -1,17 +1,17 @@
|
|
1
1
|
<template>
|
2
|
-
<div class="pd-medium for-transition w-100">
|
2
|
+
<div v-if="show" class="pd-medium for-transition w-100">
|
3
3
|
|
4
4
|
<ProfileCompletion
|
5
5
|
v-if="route.params._id === auth.state.user._id"
|
6
|
-
:user="auth.state.user._id"
|
7
|
-
:target="
|
6
|
+
:user="auth.state.user._id"
|
7
|
+
:target="users.state.current"
|
8
8
|
:cta="false"
|
9
9
|
/>
|
10
10
|
<!-- -->
|
11
11
|
<h3 class="mn-b-small">Username</h3>
|
12
12
|
|
13
13
|
<Field
|
14
|
-
v-model:field="
|
14
|
+
v-model:field="users.state.current.username"
|
15
15
|
label="@"
|
16
16
|
placeholder="Not specified"
|
17
17
|
class="mn-b-thin w-100 bg-light pd-medium radius-small"
|
@@ -25,15 +25,15 @@
|
|
25
25
|
|
26
26
|
<div class="mn-b-thin radius-small w-100 h-10r bg-light flex-center flex-column flex">
|
27
27
|
<UploadImage
|
28
|
-
v-model:photo="
|
29
|
-
:uploadPath="'users/' +
|
28
|
+
v-model:photo="users.state.current.profile.photo"
|
29
|
+
:uploadPath="'users/' + users.state.current._id + '/avatars'"
|
30
30
|
class="h-4r w-4r aspect-1x1 o-hidden bg-white mn-b-thin radius-extra"
|
31
31
|
/>
|
32
32
|
<h4>Upload userpic</h4>
|
33
33
|
</div>
|
34
34
|
|
35
35
|
<Field
|
36
|
-
v-model:field="
|
36
|
+
v-model:field="users.state.current.profile.name"
|
37
37
|
label="Name"
|
38
38
|
placeholder="Not specified"
|
39
39
|
class="mn-b-thin bg-light pd-medium radius-small"
|
@@ -41,18 +41,17 @@
|
|
41
41
|
/>
|
42
42
|
|
43
43
|
<Field
|
44
|
-
v-model:field="
|
44
|
+
v-model:field="users.state.current.profile.description"
|
45
45
|
label="Description"
|
46
46
|
placeholder="Not specified"
|
47
47
|
class="mn-b-semi bg-light pd-medium radius-small"
|
48
|
-
disabled="true"
|
49
48
|
:validation="organizationName"
|
50
49
|
/>
|
51
50
|
|
52
51
|
<!-- <p class="mn-b-thin">Select your birthday if you want to receive your birthday gift.</p>
|
53
52
|
|
54
53
|
<Field
|
55
|
-
v-model:field="
|
54
|
+
v-model:field="users.state.current.birthday"
|
56
55
|
label="Birthday"
|
57
56
|
type="date"
|
58
57
|
placeholder="Not specified"
|
@@ -63,25 +62,25 @@
|
|
63
62
|
<p class="mn-b-thin">Please provide only the username for social media profiles, without full links.</p>
|
64
63
|
|
65
64
|
<Field
|
66
|
-
v-model:field="
|
65
|
+
v-model:field="users.state.current.socials.instagram"
|
67
66
|
label="Instagram"
|
68
67
|
placeholder=""
|
69
68
|
class="mn-b-thin bg-light pd-medium radius-small"
|
70
69
|
/>
|
71
70
|
<Field
|
72
|
-
v-model:field="
|
71
|
+
v-model:field="users.state.current.socials.twitter"
|
73
72
|
label="Twitter"
|
74
73
|
placeholder=""
|
75
74
|
class="mn-b-thin bg-light pd-medium radius-small"
|
76
75
|
/>
|
77
76
|
<Field
|
78
|
-
v-model:field="
|
77
|
+
v-model:field="users.state.current.socials.facebook"
|
79
78
|
label="Facebook"
|
80
79
|
placeholder=""
|
81
80
|
class="mn-b-thin bg-light pd-medium radius-small"
|
82
81
|
/>
|
83
82
|
<Field
|
84
|
-
v-model:field="
|
83
|
+
v-model:field="users.state.current.socials.telegram"
|
85
84
|
label="Telegram"
|
86
85
|
placeholder=""
|
87
86
|
class="mn-b-semi bg-light pd-medium radius-small"
|
@@ -90,7 +89,7 @@
|
|
90
89
|
<h3 class="mn-b-small">Account</h3>
|
91
90
|
|
92
91
|
<Field
|
93
|
-
v-model:field="
|
92
|
+
v-model:field="users.state.current.phone"
|
94
93
|
label="Phone"
|
95
94
|
placeholder="Not specified"
|
96
95
|
class="mn-b-thin bg-light pd-medium mn-b-thin radius-small"
|
@@ -99,17 +98,29 @@
|
|
99
98
|
/>
|
100
99
|
|
101
100
|
<Field
|
102
|
-
v-model:field="
|
101
|
+
v-model:field="users.state.current.email"
|
103
102
|
label="Email"
|
104
103
|
placeholder="Not specified"
|
105
|
-
class="mn-b-semi
|
104
|
+
class="mn-b-semi bg-light pd-medium radius-small"
|
106
105
|
:disabled="true"
|
107
106
|
:validation="organizationName"
|
108
107
|
/>
|
109
108
|
|
110
|
-
<Button
|
109
|
+
<Button
|
110
|
+
:submit="onSubmit"
|
111
|
+
:callback="redirectTo"
|
112
|
+
class="mn-b-thin bg-main w-100"
|
113
|
+
>
|
114
|
+
Save
|
115
|
+
</Button>
|
111
116
|
|
112
|
-
<Button
|
117
|
+
<Button
|
118
|
+
:submit="onSubmitDelete"
|
119
|
+
:callback="a = () => {router.push({name: 'Sign In'})}"
|
120
|
+
class="mn-b-thin w-100 bg-red t-white"
|
121
|
+
>
|
122
|
+
Delete Account
|
123
|
+
</Button>
|
113
124
|
</div>
|
114
125
|
</template>
|
115
126
|
|
@@ -132,10 +143,14 @@
|
|
132
143
|
// Accessing router
|
133
144
|
const route = useRoute()
|
134
145
|
const router = useRouter()
|
135
|
-
|
136
|
-
const user = ref(
|
146
|
+
|
147
|
+
const user = ref(null)
|
148
|
+
const show = ref(false)
|
149
|
+
|
150
|
+
|
137
151
|
onMounted(async () => {
|
138
|
-
await users.actions.read({ _id: route.params._id });
|
152
|
+
await users.actions.read({ _id: route.params._id, user: auth.state.user._id });
|
153
|
+
show.value = true
|
139
154
|
})
|
140
155
|
// Methods
|
141
156
|
async function onSubmit() {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// Middlewares
|
2
|
-
const
|
2
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
3
3
|
// Factories
|
4
4
|
const controllerFactory = require("../factories/payments.factory");
|
5
5
|
const controllerFactoryTickets = require("@pf/src/modules/events/controllers/tickets.controller");
|
@@ -16,7 +16,7 @@ module.exports = function(app, db, origins, publicPath) {
|
|
16
16
|
const controller = controllerFactory(db);
|
17
17
|
const controllerTickets = controllerFactoryTickets(db, publicPath);
|
18
18
|
|
19
|
-
const { verifySignUp, verifyUser } =
|
19
|
+
const { verifySignUp, verifyUser } = middlewareFactoryAuth(db);
|
20
20
|
|
21
21
|
observer.subscribe('checkout.session.completed', async (paymentIntent) => {
|
22
22
|
const event = await db.event.findOne({ _id: paymentIntent.metadata.product });
|
@@ -2,13 +2,13 @@
|
|
2
2
|
const rewardsControllerFactory = require('../factories/rewards.factory');
|
3
3
|
|
4
4
|
// Middlewares
|
5
|
-
const
|
5
|
+
const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
|
6
6
|
|
7
7
|
// Routes
|
8
8
|
module.exports = (app, db, wss, wdmClient, origins) => {
|
9
9
|
const controller = rewardsControllerFactory(db, wdmClient, wss);
|
10
10
|
|
11
|
-
const { authJwt, authSecret } =
|
11
|
+
const { authJwt, authSecret } = middlewareFactoryAuth(db);
|
12
12
|
|
13
13
|
app.use((req, res, next) => {
|
14
14
|
const origin = req.headers.origin;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
const jwt = require("jsonwebtoken");
|
2
|
-
|
3
|
-
const middlewareFactory = (db) => {
|
4
|
-
const User = db.user;
|
5
|
-
const Role = db.role;
|
6
|
-
|
7
|
-
const verifyToken = async (req, res, next) => {
|
8
|
-
try {
|
9
|
-
if (!req.cookies.user) {
|
10
|
-
// Вместо возврата ошибки, просто устанавливаем req.userId как null
|
11
|
-
req.userId = null;
|
12
|
-
return next();
|
13
|
-
}
|
14
|
-
|
15
|
-
let user = JSON.parse(req.cookies.user);
|
16
|
-
let token = req.headers["x-access-token"] || user.accessToken;
|
17
|
-
|
18
|
-
if (!token) {
|
19
|
-
// Также устанавливаем req.userId как null
|
20
|
-
req.userId = null;
|
21
|
-
return next();
|
22
|
-
}
|
23
|
-
|
24
|
-
const decoded = jwt.verify(token, process.env.SECRET_KEY);
|
25
|
-
req.userId = decoded._id;
|
26
|
-
|
27
|
-
next();
|
28
|
-
} catch (err) {
|
29
|
-
console.log(err);
|
30
|
-
req.userId = null;
|
31
|
-
next();
|
32
|
-
}
|
33
|
-
};
|
34
|
-
|
35
|
-
const checkRole = roleToCheck => async (req, res, next) => {
|
36
|
-
try {
|
37
|
-
const user = await User.findById(req.userId).exec();
|
38
|
-
|
39
|
-
if (!user) {
|
40
|
-
return res.status(404).send({ message: "User Not found." });
|
41
|
-
}
|
42
|
-
|
43
|
-
const roles = await Role.find({ _id: { $in: user.roles }}).exec();
|
44
|
-
|
45
|
-
for (let role of roles) {
|
46
|
-
if (role.name === roleToCheck) {
|
47
|
-
next();
|
48
|
-
return;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
res.status(403).send({ message: `Require ${roleToCheck} Role!` });
|
53
|
-
} catch (err) {
|
54
|
-
res.status(500).send({ message: err.message });
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
const isAdmin = checkRole("admin");
|
59
|
-
const isModerator = checkRole("moderator");
|
60
|
-
|
61
|
-
return {
|
62
|
-
verifyToken,
|
63
|
-
isAdmin,
|
64
|
-
isModerator
|
65
|
-
};
|
66
|
-
};
|
67
|
-
|
68
|
-
module.exports = middlewareFactory;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|