@ozdao/martyrs 0.2.473 → 0.2.475
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Media-DW8RLbfM.js → Media-_vz04tII.js} +1 -1
- package/dist/{Media-y_TX6us_.mjs → Media-sGk7Bp9b.mjs} +1 -1
- package/dist/auth.server.js +6 -2
- package/dist/auth.server.mjs +6 -2
- package/dist/authJwt-CELQKF2s.js +82 -0
- package/dist/authJwt-DnXu3BFq.mjs +83 -0
- package/dist/builder.js +7 -4
- package/dist/builder.mjs +7 -4
- package/dist/chats.server.js +1 -1
- package/dist/chats.server.mjs +1 -1
- package/dist/community.server.js +4 -4
- package/dist/community.server.mjs +4 -4
- package/dist/events.server.js +4 -4
- package/dist/events.server.mjs +4 -4
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +3 -3
- package/dist/gallery.server.mjs +3 -3
- package/dist/{globals.abac-DT0VjfaZ.js → globals.abac-Bn-4tbX8.js} +110 -16
- package/dist/{globals.abac-CvmZM8XG.mjs → globals.abac-DZpTRxKR.mjs} +110 -16
- package/dist/globals.server.js +70 -10
- package/dist/globals.server.mjs +70 -10
- package/dist/{globals.verifier-C_VZYebB.mjs → globals.verifier-BdJxc8-8.mjs} +34 -0
- package/dist/{globals.verifier-ChDpCdy_.js → globals.verifier-CKYpYfQl.js} +34 -0
- package/dist/{index-CVXl1rB5.js → index-BOmxJQ5W.js} +7 -86
- package/dist/{index-Df8vtZx7.mjs → index-C_Fw0Umg.mjs} +7 -86
- package/dist/{main-CgmHzhq5.mjs → main-CqMtW7Hq.mjs} +274 -276
- package/dist/{main-CCfQH-Dd.js → main-CsGkbSyK.js} +2 -2
- package/dist/martyrs/src/components/Block/Block.vue.cjs +1 -1
- package/dist/martyrs/src/components/Block/Block.vue.js +1 -1
- package/dist/martyrs/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/martyrs/src/components/Button/Button.vue2.js +1 -1
- package/dist/martyrs/src/components/Chips/{Chips.vue2.cjs → Chips.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue2.js → Chips.vue.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
- package/dist/martyrs/src/components/Loader/{Loader.vue2.cjs → Loader.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Loader/{Loader.vue2.js.map → Loader.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Loader/{Loader.vue2.js → Loader.vue.js} +2 -2
- package/dist/martyrs/src/components/Loader/Loader.vue.js.map +1 -0
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.js +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.cjs +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.js +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
- package/dist/martyrs/src/components/Slider/Slider.native.vue.cjs +1 -1
- package/dist/martyrs/src/components/Slider/Slider.native.vue.js +1 -1
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.cjs → Tooltip.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.js.map → Tooltip.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue2.js → Tooltip.vue.js} +2 -2
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue.js.map +1 -0
- package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
- package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
- package/dist/martyrs/src/modules/community/community.client.js +27 -27
- package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +2 -2
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +4 -5
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +4 -5
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/sections/Feed.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/Feed.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/sections/List.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/List.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +88 -27
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +89 -28
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.js +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/Images360.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/Images360.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +21 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +21 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/store/categories.cjs +2 -0
- package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.js +2 -0
- package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +31 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +31 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/spots/store/spots.cjs +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +1 -1
- package/dist/notifications.server.mjs +1 -1
- package/dist/orders.server.js +5 -4
- package/dist/orders.server.mjs +5 -4
- package/dist/organizations.server.js +120 -47
- package/dist/organizations.server.mjs +120 -47
- package/dist/{ownership.schema-C0w02Vw1.mjs → ownership.schema-CNCotD3D.mjs} +10 -4
- package/dist/{ownership.schema-Ck2H9clB.js → ownership.schema-MxfJlPtq.js} +10 -4
- package/dist/products.server.js +415 -149
- package/dist/products.server.mjs +415 -149
- package/dist/{profile.schema-h61hhB2w.js → profile.schema-BLSuV_VC.js} +0 -4
- package/dist/{profile.schema-kP_zKXNt.mjs → profile.schema-BRuvQ7QV.mjs} +0 -4
- package/dist/{queryProcessor-CWnMIe2U.mjs → queryProcessor-CVKI651_.mjs} +62 -8
- package/dist/{queryProcessor-D6GuKfTV.js → queryProcessor-DSUqSk3I.js} +62 -8
- package/dist/rents.server.js +4 -4
- package/dist/rents.server.mjs +4 -4
- package/dist/spots.server.js +162 -8
- package/dist/spots.server.mjs +162 -8
- package/dist/style.css +27 -4
- package/dist/wallet.server.js +2 -2
- package/dist/wallet.server.mjs +2 -2
- package/package.json +1 -1
- package/src/builder/rspack/rspack.config.base.js +1 -1
- package/src/builder/rspack/rspack.config.client.js +13 -5
- package/src/components/Select/Select.vue +4 -2
- package/src/modules/auth/models/user.model.js +4 -1
- package/src/modules/community/components/sections/HotPosts.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.abac.js +148 -23
- package/src/modules/globals/controllers/classes/globals.validator.js +37 -0
- package/src/modules/globals/controllers/classes/globals.verifier.js +2 -0
- package/src/modules/globals/controllers/policies/globals.policies.js +91 -74
- package/src/modules/globals/controllers/utils/queryProcessor.js +59 -11
- package/src/modules/globals/models/schemas/ownership.schema.js +11 -6
- package/src/modules/globals/models/schemas/profile.schema.js +0 -4
- package/src/modules/music/components/layouts/MusicLayout.vue +10 -58
- package/src/modules/music/components/pages/MusicHome.vue +5 -5
- package/src/modules/orders/components/pages/OrderCreate.vue +84 -12
- package/src/modules/orders/controllers/orders.controller.js +3 -0
- package/src/modules/orders/store/shopcart.js +1 -0
- package/src/modules/organizations/models/schemas/accesses.schema.js +18 -0
- package/src/modules/organizations/policies/organizations.policies.js +117 -61
- package/src/modules/products/components/pages/CategoryEdit.vue +27 -2
- package/src/modules/products/components/pages/Product.vue +1 -0
- package/src/modules/products/components/pages/ProductEdit.vue +2 -2
- package/src/modules/products/controllers/categories.controller.js +297 -133
- package/src/modules/products/middlewares/categories.verifier.js +177 -0
- package/src/modules/products/models/category.model.js +12 -14
- package/src/modules/products/routes/categories.routes.js +50 -11
- package/src/modules/products/store/categories.js +2 -0
- package/src/modules/spots/components/pages/SpotEdit.vue +21 -17
- package/src/modules/spots/components/sections/WorktimeEdit.vue +840 -0
- package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +109 -0
- package/src/modules/spots/controllers/spots.controller.js +2 -1
- package/src/modules/spots/models/spot.model.js +59 -13
- package/src/modules/spots/store/spots.js +4 -1
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue2.cjs.map +0 -1
- package/src/modules/products/middlewares/index.js +0 -11
- package/src/modules/products/middlewares/verifyCategory.js +0 -25
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// middlewares/categories.verifier.js
|
|
2
|
+
const Verifier = require('@martyrs/src/modules/globals/controllers/classes/globals.verifier');
|
|
3
|
+
const Validator = require('@martyrs/src/modules/globals/controllers/classes/globals.validator');
|
|
4
|
+
|
|
5
|
+
module.exports = function(db) {
|
|
6
|
+
// Конфигурация валидатора для запросов
|
|
7
|
+
const queryValidatorConfig = {
|
|
8
|
+
parent: { allowed: true, validator: Validator.schema().string() },
|
|
9
|
+
url: { allowed: true, validator: Validator.schema().string() },
|
|
10
|
+
search: { allowed: true, validator: Validator.schema().string() },
|
|
11
|
+
sortParam: { allowed: true, validator: Validator.schema().string().oneOf(['order', 'name', 'createdAt', 'updatedAt']), default: 'order' },
|
|
12
|
+
sortOrder: { allowed: true, validator: Validator.schema().string().oneOf(['asc', 'desc']), default: 'asc' },
|
|
13
|
+
skip: { allowed: true, validator: Validator.schema().number().integer().min(0), default: 0 },
|
|
14
|
+
limit: { allowed: true, validator: Validator.schema().number().integer().min(1).max(100), default: 10 },
|
|
15
|
+
excludeChildren: { allowed: true, validator: Validator.schema().string().oneOf(['true', 'false']), default: 'true' },
|
|
16
|
+
rootOnly: { allowed: true, validator: Validator.schema().string().oneOf(['true', 'false']), default: 'false' },
|
|
17
|
+
status: { allowed: true, validator: Validator.schema().string().oneOf(['draft', 'internal', 'published', 'removed']) },
|
|
18
|
+
type: { allowed: true, validator: Validator.schema().string().oneOf(['platform', 'organization', 'all']), default: 'all' },
|
|
19
|
+
organizationId: { allowed: true, validator: Validator.schema().string() }
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const bodyValidatorConfig = {
|
|
23
|
+
_id: { allowed: true, validator: Validator.schema().string() },
|
|
24
|
+
name: { allowed: true, validator: Validator.schema().string().required() },
|
|
25
|
+
description: { allowed: true, validator: Validator.schema().string() },
|
|
26
|
+
photo: { allowed: true, validator: Validator.schema().string() },
|
|
27
|
+
status: { allowed: true, validator: Validator.schema().string().oneOf(['draft', 'internal', 'published', 'removed']), default: 'draft' },
|
|
28
|
+
url: { allowed: true, validator: Validator.schema().string().required() },
|
|
29
|
+
parent: { allowed: true, validator: Validator.schema().oneOfTypes(['string', 'null']) },
|
|
30
|
+
localization: { allowed: true },
|
|
31
|
+
filters: { allowed: true },
|
|
32
|
+
owner: { allowed: true, validator: Validator.schema().object({
|
|
33
|
+
type: Validator.schema().string().oneOf(['platform', 'organization']).required(),
|
|
34
|
+
target: Validator.schema().string()
|
|
35
|
+
}) },
|
|
36
|
+
creator: { allowed: true, validator: Validator.schema().object({
|
|
37
|
+
type: Validator.schema().string().oneOf(['user', 'organization']).required(),
|
|
38
|
+
target: Validator.schema().string()
|
|
39
|
+
}) },
|
|
40
|
+
children: { allowed: true, validator: Validator.schema().array() },
|
|
41
|
+
order: { allowed: true, validator: Validator.schema().number() }
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const orderBodyValidatorConfig = {
|
|
45
|
+
categories: {
|
|
46
|
+
allowed: true,
|
|
47
|
+
validator: Validator.schema().array().required(),
|
|
48
|
+
default: []
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const deleteBodyValidatorConfig = {
|
|
53
|
+
url: {
|
|
54
|
+
allowed: true,
|
|
55
|
+
validator: Validator.schema().string().required()
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const queryVerifier = new Verifier(queryValidatorConfig);
|
|
60
|
+
const bodyVerifier = new Verifier(bodyValidatorConfig);
|
|
61
|
+
const orderBodyVerifier = new Verifier(orderBodyValidatorConfig);
|
|
62
|
+
const deleteBodyVerifier = new Verifier(deleteBodyValidatorConfig);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
// Верификация параметров запроса
|
|
66
|
+
verifyQuery(req, res, next) {
|
|
67
|
+
const verification = queryVerifier.verify(req.query);
|
|
68
|
+
if (!verification.isValid) {
|
|
69
|
+
return res.status(400).json({
|
|
70
|
+
errors: verification.verificationErrors,
|
|
71
|
+
message: 'Invalid query parameters'
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
req.verifiedQuery = verification.verifiedData;
|
|
75
|
+
next();
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Верификация тела запроса для создания/обновления категории
|
|
79
|
+
verifyBody(req, res, next) {
|
|
80
|
+
const verification = bodyVerifier.verify(req.body);
|
|
81
|
+
if (!verification.isValid) {
|
|
82
|
+
return res.status(400).json({
|
|
83
|
+
errors: verification.verificationErrors,
|
|
84
|
+
message: 'Invalid request data'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
req.verifiedBody = verification.verifiedData;
|
|
88
|
+
next();
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
// Верификация тела запроса для обновления порядка категорий
|
|
92
|
+
verifyOrderBody(req, res, next) {
|
|
93
|
+
const verification = orderBodyVerifier.verify(req.body);
|
|
94
|
+
if (!verification.isValid) {
|
|
95
|
+
return res.status(400).json({
|
|
96
|
+
errors: verification.verificationErrors,
|
|
97
|
+
message: 'Invalid request data'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
req.verifiedBody = verification.verifiedData;
|
|
101
|
+
next();
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// Верификация тела запроса для удаления категории
|
|
105
|
+
verifyDeleteBody(req, res, next) {
|
|
106
|
+
const verification = deleteBodyVerifier.verify(req.body);
|
|
107
|
+
if (!verification.isValid) {
|
|
108
|
+
return res.status(400).json({
|
|
109
|
+
errors: verification.verificationErrors,
|
|
110
|
+
message: 'Invalid request data'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
req.verifiedBody = verification.verifiedData;
|
|
114
|
+
next();
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
// Проверка на существование категории с тем же URL (для создания)
|
|
118
|
+
async checkCategoryExistOrNot(req, res, next) {
|
|
119
|
+
try {
|
|
120
|
+
if (!req.verifiedBody.url) {
|
|
121
|
+
return res.status(400).json({ message: 'URL is required' });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const existingCategory = await db.category.findOne({ url: req.verifiedBody.url });
|
|
125
|
+
if (existingCategory) {
|
|
126
|
+
return res.status(409).json({
|
|
127
|
+
message: 'Category with this URL already exists',
|
|
128
|
+
category: existingCategory
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
next();
|
|
132
|
+
} catch (error) {
|
|
133
|
+
res.status(500).json({ message: error.message });
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
// Загрузка категории для проверки ABAC (для обновления и удаления)
|
|
138
|
+
async loadCategoryForUpdate(req, res, next) {
|
|
139
|
+
try {
|
|
140
|
+
const categoryId = req.verifiedBody._id;
|
|
141
|
+
if (!categoryId) {
|
|
142
|
+
return res.status(400).json({ message: 'Category ID is required' });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const category = await db.category.findById(categoryId).lean();
|
|
146
|
+
if (!category) {
|
|
147
|
+
return res.status(404).json({ message: 'Category not found' });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
req.currentResource = category; // Устанавливаем для ABAC
|
|
151
|
+
next();
|
|
152
|
+
} catch (error) {
|
|
153
|
+
res.status(500).json({ message: error.message });
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
// Загрузка категории по URL для удаления
|
|
158
|
+
async loadCategoryForDelete(req, res, next) {
|
|
159
|
+
try {
|
|
160
|
+
const url = req.verifiedBody.url;
|
|
161
|
+
if (!url) {
|
|
162
|
+
return res.status(400).json({ message: 'Category URL is required' });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const category = await db.category.findOne({ url }).lean();
|
|
166
|
+
if (!category) {
|
|
167
|
+
return res.status(404).json({ message: 'Category not found' });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
req.currentResource = category; // Устанавливаем для ABAC
|
|
171
|
+
next();
|
|
172
|
+
} catch (error) {
|
|
173
|
+
res.status(500).json({ message: error.message });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
};
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
+
// models/category.model.js
|
|
1
2
|
module.exports = (db) => {
|
|
2
3
|
const CategorySchema = new db.mongoose.Schema({
|
|
3
4
|
name: { type: String, required: true, trim: true },
|
|
4
5
|
description: { type: String, trim: true },
|
|
5
|
-
photo: {
|
|
6
|
-
type: String
|
|
7
|
-
},
|
|
8
|
-
status: {
|
|
9
|
-
type: String,
|
|
10
|
-
enum: ['draft','internal','published','removed'],
|
|
11
|
-
default: 'draft',
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
6
|
+
photo: { type: String },
|
|
14
7
|
order: { type: Number, required: true },
|
|
15
|
-
url: { type: String, required: true, trim: true },
|
|
8
|
+
url: { type: String, required: true, trim: true, unique: true },
|
|
16
9
|
parent: { type: db.mongoose.Schema.Types.ObjectId, ref: 'Category' },
|
|
17
10
|
localization: { type: Array },
|
|
18
11
|
filters: { type: Array }
|
|
19
12
|
}, {
|
|
20
13
|
timestamps: { currentTime: () => Date.now() }
|
|
21
14
|
});
|
|
22
|
-
|
|
15
|
+
|
|
16
|
+
// Применяем глобальные схемы
|
|
17
|
+
require('@martyrs/src/modules/globals/models/schemas/common.schema')(CategorySchema, db);
|
|
18
|
+
require('@martyrs/src/modules/globals/models/schemas/ownership.schema')(CategorySchema, db);
|
|
19
|
+
require('@martyrs/src/modules/globals/models/schemas/metadata.schema')(CategorySchema, db);
|
|
20
|
+
require('@martyrs/src/modules/globals/models/schemas/engagement.schema')(CategorySchema, db);
|
|
21
|
+
|
|
23
22
|
CategorySchema.index({ parent: 1 });
|
|
24
|
-
CategorySchema.index({
|
|
23
|
+
CategorySchema.index({ name: 1 });
|
|
25
24
|
|
|
26
25
|
const Category = db.mongoose.model('Category', CategorySchema, 'categories');
|
|
27
|
-
|
|
28
26
|
return Category;
|
|
29
|
-
};
|
|
27
|
+
};
|
|
@@ -1,18 +1,57 @@
|
|
|
1
|
-
//
|
|
2
|
-
const controllerFactory = require("../controllers/categories.controller");
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
// routes/categories.routes.js
|
|
2
|
+
const controllerFactory = require("../controllers/categories.controller.js");
|
|
3
|
+
const verifierFactory = require('../middlewares/categories.verifier.js');
|
|
4
|
+
const jwtFactory = require('@martyrs/src/modules/auth/controllers/middlewares/authJwt.js');
|
|
5
|
+
|
|
6
|
+
const { getInstance } = require('@martyrs/src/modules/globals/controllers/classes/globals.abac.js');
|
|
5
7
|
|
|
6
8
|
module.exports = function(app, db) {
|
|
9
|
+
const jwt = jwtFactory(db);
|
|
10
|
+
const verifier = verifierFactory(db);
|
|
11
|
+
const abac = getInstance(db);
|
|
7
12
|
const controller = controllerFactory(db);
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// Маршруты API
|
|
15
|
+
app.get('/api/categories',
|
|
16
|
+
jwt.verifyToken(true),
|
|
17
|
+
verifier.verifyQuery,
|
|
18
|
+
controller.read
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
app.post(
|
|
22
|
+
'/api/categories/create',
|
|
23
|
+
jwt.verifyToken(),
|
|
24
|
+
verifier.verifyBody,
|
|
25
|
+
verifier.checkCategoryExistOrNot,
|
|
26
|
+
abac.middleware('category', 'create'),
|
|
27
|
+
controller.create
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
app.post(
|
|
31
|
+
'/api/categories/update',
|
|
32
|
+
jwt.verifyToken(),
|
|
33
|
+
verifier.verifyBody,
|
|
34
|
+
verifier.loadCategoryForUpdate,
|
|
35
|
+
abac.middleware('category', 'edit'),
|
|
36
|
+
controller.update
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
app.post(
|
|
40
|
+
'/api/categories/updateOrder',
|
|
41
|
+
jwt.verifyToken(),
|
|
42
|
+
verifier.verifyOrderBody,
|
|
43
|
+
abac.middleware('category', 'edit'),
|
|
44
|
+
controller.updateOrder
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
app.post(
|
|
48
|
+
'/api/categories/delete',
|
|
49
|
+
jwt.verifyToken(),
|
|
50
|
+
verifier.verifyDeleteBody,
|
|
51
|
+
verifier.loadCategoryForDelete,
|
|
52
|
+
abac.middleware('category', 'delete'),
|
|
53
|
+
controller.delete
|
|
54
|
+
);
|
|
16
55
|
};
|
|
17
56
|
|
|
18
57
|
module.exports.controllerFactory = controllerFactory;
|
|
@@ -18,15 +18,11 @@
|
|
|
18
18
|
</Block>
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
<div class="cols-2 gap-thin">
|
|
22
|
-
|
|
21
|
+
<div class="cols-2 gap-thin">
|
|
23
22
|
<Block
|
|
24
23
|
title="Profile"
|
|
25
24
|
class="mn-b-semi"
|
|
26
25
|
>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
26
|
<div class="gap-small mn-b-small cols-2-fit-content">
|
|
31
27
|
<UploadImage
|
|
32
28
|
v-model:photo="spots.state.spot.profile.photo"
|
|
@@ -52,6 +48,14 @@
|
|
|
52
48
|
</div>
|
|
53
49
|
</div>
|
|
54
50
|
|
|
51
|
+
<Field
|
|
52
|
+
v-model:field="spots.state.spot.minorder"
|
|
53
|
+
label="Min.order"
|
|
54
|
+
placeholder="Enter minimum order value"
|
|
55
|
+
class="bg-white radius-small mn-b-small pd-small"
|
|
56
|
+
:validation="organizationName"
|
|
57
|
+
/>
|
|
58
|
+
|
|
55
59
|
<Select
|
|
56
60
|
v-model:select="spots.state.spot.status"
|
|
57
61
|
label="Status"
|
|
@@ -60,10 +64,10 @@
|
|
|
60
64
|
'published',
|
|
61
65
|
'archivied'
|
|
62
66
|
]"
|
|
63
|
-
placeholder="
|
|
67
|
+
placeholder="Status"
|
|
64
68
|
class="pos-relative w-100 mn-b-small bg-white radius-small pd-medium"
|
|
65
69
|
/>
|
|
66
|
-
|
|
70
|
+
|
|
67
71
|
<p class="p-medium mn-b-small">Please the available delivery options:</p>
|
|
68
72
|
|
|
69
73
|
<Checkbox
|
|
@@ -125,6 +129,12 @@
|
|
|
125
129
|
spots.state.spot.address = newAddress;
|
|
126
130
|
}"
|
|
127
131
|
/>
|
|
132
|
+
{{spots.state.spot.worktime}}
|
|
133
|
+
<WorktimeEdit
|
|
134
|
+
v-model:worktime="spots.state.spot.worktime"
|
|
135
|
+
class="mn-b-small"
|
|
136
|
+
/>
|
|
137
|
+
|
|
128
138
|
<p class="mn-b-small p-medium">Options:</p>
|
|
129
139
|
<Checkbox
|
|
130
140
|
:label="'Hide address'"
|
|
@@ -132,18 +142,10 @@
|
|
|
132
142
|
class="w-100 mn-r-small bg-white radius-small pd-small"
|
|
133
143
|
:radio="spots.state.spot.position?.hide"
|
|
134
144
|
@update:radio="event => spots.state.spot.position.hide = event"
|
|
135
|
-
|
|
136
145
|
/>
|
|
137
146
|
|
|
138
|
-
<Field
|
|
139
|
-
v-model:field="spots.state.spot.minorder"
|
|
140
|
-
label="Min.order"
|
|
141
|
-
placeholder="Enter minimum order value"
|
|
142
|
-
class="bg-white radius-small pd-medium"
|
|
143
|
-
:validation="organizationName"
|
|
144
|
-
/>
|
|
145
|
-
|
|
146
147
|
</Block>
|
|
148
|
+
|
|
147
149
|
</div>
|
|
148
150
|
|
|
149
151
|
<Button :submit="onDelete" :callback="redirectDash" class="w-100 bg-light">Delete Spot</Button>
|
|
@@ -166,6 +168,8 @@ import LocationMarker from "@martyrs/src/components/LocationMarker/LocationMarke
|
|
|
166
168
|
import Button from "@martyrs/src/components/Button/Button.vue";
|
|
167
169
|
import Popup from "@martyrs/src/components/Popup/Popup.vue";
|
|
168
170
|
|
|
171
|
+
import WorktimeEdit from "../sections/WorktimeEdit.vue";
|
|
172
|
+
|
|
169
173
|
import * as spots from "@martyrs/src/modules/spots/store/spots";
|
|
170
174
|
|
|
171
175
|
const router = useRouter();
|
|
@@ -214,7 +218,7 @@ async function onSubmit() {
|
|
|
214
218
|
|
|
215
219
|
function redirectTo() {
|
|
216
220
|
// router.replace({ name: "Spot", params: { _id: route.params._id, spot: spots.state.spot._id } });
|
|
217
|
-
router.push({ name: "Organization", params: { _id: route.params._id }});
|
|
221
|
+
router.push({ name: "Organization", query: { tab: 'spots' }, params: { _id: route.params._id }});
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
async function onDelete() {
|