@ozdao/martyrs 0.2.472 → 0.2.474
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/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +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/Button/{Button.vue.cjs → Button.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Button/{Button.vue.js → Button.vue2.js} +2 -2
- package/dist/martyrs/src/components/Button/{Button.vue.cjs.map → Button.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.cjs → Dropdown.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.js.map → Dropdown.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue2.js → Dropdown.vue.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +1 -0
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +1 -1
- package/dist/martyrs/src/components/Menu/{Menu.vue2.cjs → Menu.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Menu/{Menu.vue2.js → Menu.vue.js} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue.js.map +1 -0
- 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/Tab/{Tab.vue.cjs → Tab.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Tab/{Tab.vue.js → Tab.vue2.js} +2 -2
- package/dist/martyrs/src/components/Tab/{Tab.vue.cjs.map → Tab.vue2.js.map} +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +3 -3
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +3 -3
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
- 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/pages/BlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +3 -4
- 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 +3 -4
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.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/EditEventTickets.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.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/globals.client.cjs +2 -0
- package/dist/martyrs/src/modules/globals/globals.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/globals.client.js +3 -1
- package/dist/martyrs/src/modules/globals/globals.client.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +2 -2
- 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/Header.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.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/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.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 +89 -28
- 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 +90 -29
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- 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/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +1 -1
- 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/MembersAdd.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- 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/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.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/Leftovers.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +3 -2
- 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 +3 -2
- 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 +4 -4
- 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 +4 -4
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.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/SectionProduct.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +2 -2
- 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/rents/views/components/pages/GanttChart.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.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/Map.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +32 -26
- 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 +32 -26
- 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/{martyrs → node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_}/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs +1 -1
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs.map +1 -0
- package/dist/{martyrs → node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_}/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js +1 -1
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js.map +1 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.13/node_modules/@vue/shared/dist/shared.esm-bundler.cjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.13/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.cjs +6 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.cjs.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js +6 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/{martyrs → node_modules/.pnpm/uuid@11.1.0}/node_modules/uuid/dist/esm-browser/rng.cjs +4 -4
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.cjs.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js +15 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.cjs +11 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.cjs.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js +11 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.cjs +21 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.cjs.map +1 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js +21 -0
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- 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/globals.client.js +3 -0
- 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 +85 -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/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs.map +0 -1
- package/dist/martyrs/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js.map +0 -1
- package/dist/martyrs/node_modules/@vue/shared/dist/shared.esm-bundler.cjs.map +0 -1
- package/dist/martyrs/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.cjs +0 -5
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.cjs.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.js +0 -5
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.js.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.cjs.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.js +0 -15
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.cjs +0 -17
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.cjs.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.js +0 -17
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.cjs +0 -13
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.cjs.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.js +0 -13
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.cjs +0 -8
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.cjs.map +0 -1
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.js +0 -8
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.js.map +0 -1
- package/dist/martyrs/src/components/Button/Button.vue.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Tab/Tab.vue.js.map +0 -1
- package/src/modules/products/middlewares/index.js +0 -11
- package/src/modules/products/middlewares/verifyCategory.js +0 -25
- /package/dist/{martyrs → node_modules/.pnpm/@vue_shared@3.5.13}/node_modules/@vue/shared/dist/shared.esm-bundler.cjs +0 -0
- /package/dist/{martyrs → node_modules/.pnpm/@vue_shared@3.5.13}/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -0
- /package/dist/{martyrs/node_modules → node_modules}/fast-deep-equal/index.cjs +0 -0
- /package/dist/{martyrs/node_modules → node_modules}/fast-deep-equal/index.cjs.map +0 -0
- /package/dist/{martyrs/node_modules → node_modules}/fast-deep-equal/index.js +0 -0
- /package/dist/{martyrs/node_modules → node_modules}/fast-deep-equal/index.js.map +0 -0
package/dist/products.server.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
|
-
const ownership_schema = require("./ownership.schema-
|
|
3
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
4
|
+
const common_schema = require("./common.schema-O0w_rDyC.js");
|
|
5
|
+
const metadata_schema = require("./metadata.schema-CUkLXZ2f.js");
|
|
6
|
+
const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
|
|
4
7
|
const require$$0 = require("uuid");
|
|
5
8
|
const require$$0$1 = require("mongoose");
|
|
6
9
|
require("path");
|
|
7
10
|
const require$$3 = require("openai");
|
|
8
|
-
const queryProcessor = require("./queryProcessor-
|
|
11
|
+
const queryProcessor = require("./queryProcessor-DSUqSk3I.js");
|
|
12
|
+
const globals_logger = require("./globals.logger-BdjooLaD.js");
|
|
13
|
+
const globals_cache = require("./globals.cache-CwWvNGFQ.js");
|
|
14
|
+
const globals_verifier = require("./globals.verifier-CKYpYfQl.js");
|
|
15
|
+
const authJwt = require("./authJwt-CELQKF2s.js");
|
|
16
|
+
const globals_abac = require("./globals.abac-Bn-4tbX8.js");
|
|
9
17
|
var product_model;
|
|
10
18
|
var hasRequiredProduct_model;
|
|
11
19
|
function requireProduct_model() {
|
|
@@ -131,25 +139,21 @@ function requireCategory_model() {
|
|
|
131
139
|
const CategorySchema = new db.mongoose.Schema({
|
|
132
140
|
name: { type: String, required: true, trim: true },
|
|
133
141
|
description: { type: String, trim: true },
|
|
134
|
-
photo: {
|
|
135
|
-
type: String
|
|
136
|
-
},
|
|
137
|
-
status: {
|
|
138
|
-
type: String,
|
|
139
|
-
enum: ["draft", "internal", "published", "removed"],
|
|
140
|
-
default: "draft",
|
|
141
|
-
required: true
|
|
142
|
-
},
|
|
142
|
+
photo: { type: String },
|
|
143
143
|
order: { type: Number, required: true },
|
|
144
|
-
url: { type: String, required: true, trim: true },
|
|
144
|
+
url: { type: String, required: true, trim: true, unique: true },
|
|
145
145
|
parent: { type: db.mongoose.Schema.Types.ObjectId, ref: "Category" },
|
|
146
146
|
localization: { type: Array },
|
|
147
147
|
filters: { type: Array }
|
|
148
148
|
}, {
|
|
149
149
|
timestamps: { currentTime: () => Date.now() }
|
|
150
150
|
});
|
|
151
|
+
common_schema.requireCommon_schema()(CategorySchema, db);
|
|
152
|
+
ownership_schema.requireOwnership_schema()(CategorySchema, db);
|
|
153
|
+
metadata_schema.requireMetadata_schema()(CategorySchema, db);
|
|
154
|
+
engagement_schema.requireEngagement_schema()(CategorySchema, db);
|
|
151
155
|
CategorySchema.index({ parent: 1 });
|
|
152
|
-
CategorySchema.index({
|
|
156
|
+
CategorySchema.index({ name: 1 });
|
|
153
157
|
const Category = db.mongoose.model("Category", CategorySchema, "categories");
|
|
154
158
|
return Category;
|
|
155
159
|
};
|
|
@@ -631,78 +635,61 @@ var hasRequiredCategories_controller;
|
|
|
631
635
|
function requireCategories_controller() {
|
|
632
636
|
if (hasRequiredCategories_controller) return categories_controller;
|
|
633
637
|
hasRequiredCategories_controller = 1;
|
|
638
|
+
const globalsQuery = queryProcessor.requireQueryProcessor();
|
|
639
|
+
const Logger = globals_logger.requireGlobals_logger();
|
|
640
|
+
const Cache = globals_cache.requireGlobals_cache();
|
|
634
641
|
const controllerFactory = (db) => {
|
|
635
642
|
const Category = db.category;
|
|
643
|
+
const logger = new Logger(db);
|
|
644
|
+
const cache = new Cache();
|
|
636
645
|
return {
|
|
637
646
|
async read(req, res) {
|
|
638
647
|
try {
|
|
639
|
-
|
|
640
|
-
const categoryMap = /* @__PURE__ */ new Map();
|
|
641
|
-
categories.forEach((category) => {
|
|
642
|
-
categoryMap.set(category._id.toString(), {
|
|
643
|
-
...category,
|
|
644
|
-
children: []
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
const rootCategories = [];
|
|
648
|
-
categories.forEach((category) => {
|
|
649
|
-
const categoryWithChildren = categoryMap.get(category._id.toString());
|
|
650
|
-
if (category.parent && categoryMap.has(category.parent.toString())) {
|
|
651
|
-
const parentCategory = categoryMap.get(category.parent.toString());
|
|
652
|
-
parentCategory.children.push(categoryWithChildren);
|
|
653
|
-
} else if (!category.parent) {
|
|
654
|
-
rootCategories.push(categoryWithChildren);
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
function sortCategories(nodes) {
|
|
658
|
-
if (!nodes || nodes.length === 0) {
|
|
659
|
-
return nodes;
|
|
660
|
-
}
|
|
661
|
-
nodes.sort((a, b) => {
|
|
662
|
-
const valueA = a[sortParam2] ?? (sortParam2 === "order" ? Number.MAX_SAFE_INTEGER : "");
|
|
663
|
-
const valueB = b[sortParam2] ?? (sortParam2 === "order" ? Number.MAX_SAFE_INTEGER : "");
|
|
664
|
-
if (typeof valueA === "number" && typeof valueB === "number") {
|
|
665
|
-
return sortOrder2 === "asc" ? valueA - valueB : valueB - valueA;
|
|
666
|
-
} else {
|
|
667
|
-
const stringA = String(valueA);
|
|
668
|
-
const stringB = String(valueB);
|
|
669
|
-
return sortOrder2 === "asc" ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
nodes.forEach((node) => {
|
|
673
|
-
if (node.children && node.children.length > 0) {
|
|
674
|
-
sortCategories(node.children);
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
return nodes;
|
|
678
|
-
}
|
|
679
|
-
return sortCategories(rootCategories);
|
|
680
|
-
};
|
|
681
|
-
let {
|
|
648
|
+
const {
|
|
682
649
|
parent,
|
|
683
650
|
url,
|
|
684
651
|
search,
|
|
685
|
-
sortParam
|
|
686
|
-
sortOrder
|
|
687
|
-
skip
|
|
688
|
-
limit
|
|
689
|
-
excludeChildren
|
|
690
|
-
rootOnly
|
|
691
|
-
|
|
652
|
+
sortParam,
|
|
653
|
+
sortOrder,
|
|
654
|
+
skip,
|
|
655
|
+
limit,
|
|
656
|
+
excludeChildren,
|
|
657
|
+
rootOnly,
|
|
658
|
+
type
|
|
659
|
+
} = req.verifiedQuery;
|
|
660
|
+
const cacheKey = JSON.stringify(req.verifiedQuery);
|
|
661
|
+
let cachedResult = await cache.get(cacheKey);
|
|
662
|
+
if (cachedResult) {
|
|
663
|
+
return res.status(200).json(cachedResult);
|
|
664
|
+
}
|
|
692
665
|
const matchStage = {
|
|
693
666
|
...req.query.status && { status: req.query.status },
|
|
694
|
-
...
|
|
667
|
+
...url && { url },
|
|
695
668
|
...search && { name: { $regex: search, $options: "i" } },
|
|
696
669
|
...parent ? { parent: new db.mongoose.Types.ObjectId(parent) } : {},
|
|
697
670
|
...rootOnly === "true" && !search ? { parent: null } : {}
|
|
698
671
|
};
|
|
699
|
-
|
|
700
|
-
|
|
672
|
+
if (type === "platform") {
|
|
673
|
+
matchStage["owner.type"] = "platform";
|
|
674
|
+
} else if (type === "organization" && req.query.organizationId) {
|
|
675
|
+
matchStage["owner.type"] = "organization";
|
|
676
|
+
matchStage["owner.target"] = new db.mongoose.Types.ObjectId(req.query.organizationId);
|
|
677
|
+
}
|
|
678
|
+
if (search) {
|
|
679
|
+
excludeChildren = "true";
|
|
680
|
+
}
|
|
701
681
|
const pipeline = [
|
|
702
682
|
{ $match: matchStage },
|
|
683
|
+
globalsQuery.getCreatorUserLookupStage(),
|
|
684
|
+
globalsQuery.getCreatorOrganizationLookupStage(),
|
|
685
|
+
// For owner
|
|
686
|
+
globalsQuery.getOwnerUserLookupStage(),
|
|
687
|
+
globalsQuery.getOwnerOrganizationLookupStage(),
|
|
688
|
+
globalsQuery.getAddFieldsCreatorOwnerStage(),
|
|
703
689
|
{ $sort: { [sortParam]: sortOrder === "asc" ? 1 : -1 } },
|
|
704
690
|
{ $skip: Number(skip) },
|
|
705
|
-
{ $limit: Number(limit) }
|
|
691
|
+
{ $limit: Number(limit) },
|
|
692
|
+
globalsQuery.removeTempPropeties()
|
|
706
693
|
];
|
|
707
694
|
if (excludeChildren !== "true") {
|
|
708
695
|
pipeline.push({
|
|
@@ -717,69 +704,106 @@ function requireCategories_controller() {
|
|
|
717
704
|
});
|
|
718
705
|
}
|
|
719
706
|
const results = await Category.aggregate(pipeline);
|
|
707
|
+
let response;
|
|
720
708
|
if (excludeChildren === "true") {
|
|
721
|
-
|
|
722
|
-
res.status(200).json(results);
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
const allCategories = [];
|
|
726
|
-
results.forEach((doc) => {
|
|
727
|
-
const category = { ...doc };
|
|
728
|
-
delete category.allDescendants;
|
|
729
|
-
allCategories.push(category);
|
|
730
|
-
if (doc.allDescendants && doc.allDescendants.length > 0) {
|
|
731
|
-
allCategories.push(...doc.allDescendants);
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
const uniqueCategories = Array.from(
|
|
735
|
-
new Map(allCategories.map((item) => [item._id.toString(), item])).values()
|
|
736
|
-
);
|
|
737
|
-
const tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
|
|
738
|
-
if (rootOnly === "true") {
|
|
739
|
-
res.json(tree);
|
|
709
|
+
response = results;
|
|
740
710
|
} else {
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
711
|
+
const allCategories = [];
|
|
712
|
+
results.forEach((doc) => {
|
|
713
|
+
const category = { ...doc };
|
|
714
|
+
delete category.allDescendants;
|
|
715
|
+
allCategories.push(category);
|
|
716
|
+
if (doc.allDescendants && doc.allDescendants.length > 0) {
|
|
717
|
+
allCategories.push(...doc.allDescendants);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
const uniqueCategories = Array.from(
|
|
721
|
+
new Map(allCategories.map((item) => [item._id.toString(), item])).values()
|
|
744
722
|
);
|
|
745
|
-
|
|
723
|
+
const tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
|
|
724
|
+
if (rootOnly === "true") {
|
|
725
|
+
response = tree;
|
|
726
|
+
} else {
|
|
727
|
+
const requestedCategoryIds = results.map((r) => r._id.toString());
|
|
728
|
+
response = tree.filter(
|
|
729
|
+
(category) => requestedCategoryIds.includes(category._id.toString())
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
const tags = ["categories"];
|
|
734
|
+
if (type === "organization" && req.query.organizationId) {
|
|
735
|
+
tags.push(`organization_${req.query.organizationId}`);
|
|
736
|
+
}
|
|
737
|
+
for (const cat of response) {
|
|
738
|
+
if (cat._id) {
|
|
739
|
+
tags.push(`category_${cat._id}`);
|
|
740
|
+
}
|
|
746
741
|
}
|
|
742
|
+
await cache.setWithTags(cacheKey, response, tags);
|
|
743
|
+
res.status(200).json(response);
|
|
747
744
|
} catch (err) {
|
|
745
|
+
logger.error(`Error reading categories: ${err.message}`);
|
|
748
746
|
res.status(500).json({ message: err.message });
|
|
749
747
|
}
|
|
750
748
|
},
|
|
751
749
|
async create(req, res) {
|
|
752
750
|
try {
|
|
751
|
+
const categoryData = req.verifiedBody;
|
|
752
|
+
if (!categoryData.creator && req.userId) {
|
|
753
|
+
categoryData.creator = {
|
|
754
|
+
type: "user",
|
|
755
|
+
target: req.userId
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
if (!categoryData.owner) {
|
|
759
|
+
if (req.query.organizationId) {
|
|
760
|
+
categoryData.owner = {
|
|
761
|
+
type: "organization",
|
|
762
|
+
target: req.query.organizationId
|
|
763
|
+
};
|
|
764
|
+
} else {
|
|
765
|
+
categoryData.owner = {
|
|
766
|
+
type: "platform",
|
|
767
|
+
target: null
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
}
|
|
753
771
|
const highestOrder = await Category.findOne().sort("-order");
|
|
754
772
|
const order = highestOrder ? highestOrder.order + 1 : 1;
|
|
755
|
-
const category = new Category({
|
|
756
|
-
|
|
773
|
+
const category = new Category({
|
|
774
|
+
...categoryData,
|
|
775
|
+
order
|
|
776
|
+
});
|
|
777
|
+
if (categoryData.parent) {
|
|
757
778
|
const parent = await Category.findByIdAndUpdate(
|
|
758
|
-
|
|
779
|
+
categoryData.parent,
|
|
759
780
|
{ $push: { children: category._id } },
|
|
760
781
|
{ new: true }
|
|
761
782
|
);
|
|
762
783
|
if (!parent) throw new Error("Parent category not found");
|
|
763
784
|
category.parent = parent._id;
|
|
764
785
|
}
|
|
765
|
-
if (
|
|
786
|
+
if (categoryData.children && categoryData.children.length > 0) {
|
|
766
787
|
await Category.updateMany(
|
|
767
|
-
{ _id: { $in:
|
|
788
|
+
{ _id: { $in: categoryData.children } },
|
|
768
789
|
{ $set: { parent: category._id } }
|
|
769
790
|
);
|
|
770
791
|
}
|
|
771
792
|
await category.save();
|
|
793
|
+
await cache.delByTags(["categories"]);
|
|
794
|
+
if (category.owner.type === "organization") {
|
|
795
|
+
await cache.delByTag(`organization_${category.owner.target}`);
|
|
796
|
+
}
|
|
797
|
+
logger.info(`Category created: ${category._id}`);
|
|
772
798
|
res.status(201).json(category);
|
|
773
799
|
} catch (err) {
|
|
800
|
+
logger.error(`Error creating category: ${err.message}`);
|
|
774
801
|
res.status(err.message === "Parent category not found" ? 404 : 500).json({ message: err.message });
|
|
775
802
|
}
|
|
776
803
|
},
|
|
777
804
|
async update(req, res) {
|
|
778
805
|
try {
|
|
779
|
-
const category = req.
|
|
780
|
-
if (!category || !category._id) {
|
|
781
|
-
return res.status(400).json({ message: "Category ID is required" });
|
|
782
|
-
}
|
|
806
|
+
const category = req.verifiedBody;
|
|
783
807
|
const updatedCategory = await Category.findByIdAndUpdate(
|
|
784
808
|
category._id,
|
|
785
809
|
{ $set: category },
|
|
@@ -788,15 +812,21 @@ function requireCategories_controller() {
|
|
|
788
812
|
if (!updatedCategory) {
|
|
789
813
|
return res.status(404).json({ message: "Category not found" });
|
|
790
814
|
}
|
|
815
|
+
await cache.delByTag(`category_${category._id}`);
|
|
816
|
+
await cache.delByTags(["categories"]);
|
|
817
|
+
if (updatedCategory.owner && updatedCategory.owner.type === "organization") {
|
|
818
|
+
await cache.delByTag(`organization_${updatedCategory.owner.target}`);
|
|
819
|
+
}
|
|
820
|
+
logger.info(`Category updated: ${category._id}`);
|
|
791
821
|
res.status(200).json(updatedCategory);
|
|
792
822
|
} catch (err) {
|
|
793
|
-
|
|
823
|
+
logger.error(`Category update error: ${err.message}`);
|
|
794
824
|
res.status(500).json({ message: "Failed to update category" });
|
|
795
825
|
}
|
|
796
826
|
},
|
|
797
827
|
async updateOrder(req, res) {
|
|
798
828
|
try {
|
|
799
|
-
const { categories } = req.
|
|
829
|
+
const { categories } = req.verifiedBody;
|
|
800
830
|
const bulkOps = categories.map((category) => ({
|
|
801
831
|
updateOne: {
|
|
802
832
|
filter: { _id: category._id },
|
|
@@ -809,18 +839,44 @@ function requireCategories_controller() {
|
|
|
809
839
|
}
|
|
810
840
|
}));
|
|
811
841
|
await Category.bulkWrite(bulkOps);
|
|
812
|
-
const
|
|
813
|
-
|
|
842
|
+
const categoryIds = categories.map((cat) => cat._id);
|
|
843
|
+
const organizationIds = /* @__PURE__ */ new Set();
|
|
844
|
+
const updatedCategories = await Category.find({ _id: { $in: categoryIds } }).lean();
|
|
845
|
+
updatedCategories.forEach((cat) => {
|
|
846
|
+
if (cat.owner && cat.owner.type === "organization") {
|
|
847
|
+
organizationIds.add(cat.owner.target.toString());
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
await cache.delByTags(["categories"]);
|
|
851
|
+
for (const catId of categoryIds) {
|
|
852
|
+
await cache.delByTag(`category_${catId}`);
|
|
853
|
+
}
|
|
854
|
+
for (const orgId of organizationIds) {
|
|
855
|
+
await cache.delByTag(`organization_${orgId}`);
|
|
856
|
+
}
|
|
857
|
+
let query = {};
|
|
858
|
+
if (req.query.type === "platform") {
|
|
859
|
+
query = { "owner.type": "platform" };
|
|
860
|
+
} else if (req.query.type === "organization" && req.query.organizationId) {
|
|
861
|
+
query = {
|
|
862
|
+
"owner.type": "organization",
|
|
863
|
+
"owner.target": new db.mongoose.Types.ObjectId(req.query.organizationId)
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
const result = await Category.find(query).sort({ order: "asc" }).lean();
|
|
867
|
+
logger.info(`Categories order updated: ${categoryIds.join(", ")}`);
|
|
868
|
+
res.status(200).json(result);
|
|
814
869
|
} catch (err) {
|
|
815
|
-
|
|
816
|
-
res.status(500).json({ message: "Failed to update categories" });
|
|
870
|
+
logger.error(`Category order update error: ${err.message}`);
|
|
871
|
+
res.status(500).json({ message: "Failed to update categories order" });
|
|
817
872
|
}
|
|
818
873
|
},
|
|
819
874
|
async delete(req, res) {
|
|
820
875
|
try {
|
|
821
|
-
const category =
|
|
822
|
-
|
|
823
|
-
|
|
876
|
+
const category = req.currentResource;
|
|
877
|
+
let ownerOrgId = null;
|
|
878
|
+
if (category.owner && category.owner.type === "organization") {
|
|
879
|
+
ownerOrgId = category.owner.target;
|
|
824
880
|
}
|
|
825
881
|
const result = await Category.aggregate([
|
|
826
882
|
{ $match: { _id: category._id } },
|
|
@@ -838,72 +894,282 @@ function requireCategories_controller() {
|
|
|
838
894
|
}
|
|
839
895
|
]);
|
|
840
896
|
const idsToDelete = [category._id, ...(result[0]?.descendants || []).map(({ _id }) => _id)];
|
|
897
|
+
const categoryIdsTags = idsToDelete.map((id) => `category_${id}`);
|
|
841
898
|
await Category.deleteMany({ _id: { $in: idsToDelete } });
|
|
899
|
+
await cache.delByTags(["categories"]);
|
|
900
|
+
await cache.delByTags(categoryIdsTags);
|
|
901
|
+
if (ownerOrgId) {
|
|
902
|
+
await cache.delByTag(`organization_${ownerOrgId}`);
|
|
903
|
+
}
|
|
904
|
+
logger.info(`Category and its subcategories deleted: ${category.url}`);
|
|
842
905
|
res.status(200).json({ message: "Category and its subcategories deleted successfully" });
|
|
843
906
|
} catch (err) {
|
|
844
|
-
|
|
907
|
+
logger.error(`Error deleting category: ${err.message}`);
|
|
845
908
|
res.status(500).json({ message: err.message || "Internal server error" });
|
|
846
909
|
}
|
|
847
910
|
}
|
|
848
911
|
};
|
|
912
|
+
function buildAdjacencyTree(categories, sortParam, sortOrder) {
|
|
913
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
914
|
+
categories.forEach((category) => {
|
|
915
|
+
categoryMap.set(category._id.toString(), {
|
|
916
|
+
...category,
|
|
917
|
+
children: []
|
|
918
|
+
});
|
|
919
|
+
});
|
|
920
|
+
const rootCategories = [];
|
|
921
|
+
categories.forEach((category) => {
|
|
922
|
+
const categoryWithChildren = categoryMap.get(category._id.toString());
|
|
923
|
+
if (category.parent && categoryMap.has(category.parent.toString())) {
|
|
924
|
+
const parentCategory = categoryMap.get(category.parent.toString());
|
|
925
|
+
parentCategory.children.push(categoryWithChildren);
|
|
926
|
+
} else if (!category.parent) {
|
|
927
|
+
rootCategories.push(categoryWithChildren);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
function sortCategories(nodes) {
|
|
931
|
+
if (!nodes || nodes.length === 0) {
|
|
932
|
+
return nodes;
|
|
933
|
+
}
|
|
934
|
+
nodes.sort((a, b) => {
|
|
935
|
+
const valueA = a[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
|
|
936
|
+
const valueB = b[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
|
|
937
|
+
if (typeof valueA === "number" && typeof valueB === "number") {
|
|
938
|
+
return sortOrder === "asc" ? valueA - valueB : valueB - valueA;
|
|
939
|
+
} else {
|
|
940
|
+
const stringA = String(valueA);
|
|
941
|
+
const stringB = String(valueB);
|
|
942
|
+
return sortOrder === "asc" ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
nodes.forEach((node) => {
|
|
946
|
+
if (node.children && node.children.length > 0) {
|
|
947
|
+
sortCategories(node.children);
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
return nodes;
|
|
951
|
+
}
|
|
952
|
+
return sortCategories(rootCategories);
|
|
953
|
+
}
|
|
849
954
|
};
|
|
850
955
|
categories_controller = controllerFactory;
|
|
851
956
|
return categories_controller;
|
|
852
957
|
}
|
|
853
|
-
var
|
|
854
|
-
var
|
|
855
|
-
function
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
958
|
+
var categories_verifier;
|
|
959
|
+
var hasRequiredCategories_verifier;
|
|
960
|
+
function requireCategories_verifier() {
|
|
961
|
+
if (hasRequiredCategories_verifier) return categories_verifier;
|
|
962
|
+
hasRequiredCategories_verifier = 1;
|
|
963
|
+
const Verifier = globals_verifier.requireGlobals_verifier();
|
|
964
|
+
const Validator = globals_verifier.requireGlobals_validator();
|
|
965
|
+
categories_verifier = function(db) {
|
|
966
|
+
const queryValidatorConfig = {
|
|
967
|
+
parent: { allowed: true, validator: Validator.schema().string() },
|
|
968
|
+
url: { allowed: true, validator: Validator.schema().string() },
|
|
969
|
+
search: { allowed: true, validator: Validator.schema().string() },
|
|
970
|
+
sortParam: { allowed: true, validator: Validator.schema().string().oneOf(["order", "name", "createdAt", "updatedAt"]), default: "order" },
|
|
971
|
+
sortOrder: { allowed: true, validator: Validator.schema().string().oneOf(["asc", "desc"]), default: "asc" },
|
|
972
|
+
skip: { allowed: true, validator: Validator.schema().number().integer().min(0), default: 0 },
|
|
973
|
+
limit: { allowed: true, validator: Validator.schema().number().integer().min(1).max(100), default: 10 },
|
|
974
|
+
excludeChildren: { allowed: true, validator: Validator.schema().string().oneOf(["true", "false"]), default: "true" },
|
|
975
|
+
rootOnly: { allowed: true, validator: Validator.schema().string().oneOf(["true", "false"]), default: "false" },
|
|
976
|
+
status: { allowed: true, validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"]) },
|
|
977
|
+
type: { allowed: true, validator: Validator.schema().string().oneOf(["platform", "organization", "all"]), default: "all" },
|
|
978
|
+
organizationId: { allowed: true, validator: Validator.schema().string() }
|
|
979
|
+
};
|
|
980
|
+
const bodyValidatorConfig = {
|
|
981
|
+
_id: { allowed: true, validator: Validator.schema().string() },
|
|
982
|
+
name: { allowed: true, validator: Validator.schema().string().required() },
|
|
983
|
+
description: { allowed: true, validator: Validator.schema().string() },
|
|
984
|
+
photo: { allowed: true, validator: Validator.schema().string() },
|
|
985
|
+
status: { allowed: true, validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"]), default: "draft" },
|
|
986
|
+
url: { allowed: true, validator: Validator.schema().string().required() },
|
|
987
|
+
parent: { allowed: true, validator: Validator.schema().oneOfTypes(["string", "null"]) },
|
|
988
|
+
localization: { allowed: true },
|
|
989
|
+
filters: { allowed: true },
|
|
990
|
+
owner: { allowed: true, validator: Validator.schema().object({
|
|
991
|
+
type: Validator.schema().string().oneOf(["platform", "organization"]).required(),
|
|
992
|
+
target: Validator.schema().string()
|
|
993
|
+
}) },
|
|
994
|
+
creator: { allowed: true, validator: Validator.schema().object({
|
|
995
|
+
type: Validator.schema().string().oneOf(["user", "organization"]).required(),
|
|
996
|
+
target: Validator.schema().string()
|
|
997
|
+
}) },
|
|
998
|
+
children: { allowed: true, validator: Validator.schema().array() },
|
|
999
|
+
order: { allowed: true, validator: Validator.schema().number() }
|
|
1000
|
+
};
|
|
1001
|
+
const orderBodyValidatorConfig = {
|
|
1002
|
+
categories: {
|
|
1003
|
+
allowed: true,
|
|
1004
|
+
validator: Validator.schema().array().required(),
|
|
1005
|
+
default: []
|
|
870
1006
|
}
|
|
871
1007
|
};
|
|
872
|
-
|
|
873
|
-
|
|
1008
|
+
const deleteBodyValidatorConfig = {
|
|
1009
|
+
url: {
|
|
1010
|
+
allowed: true,
|
|
1011
|
+
validator: Validator.schema().string().required()
|
|
1012
|
+
}
|
|
874
1013
|
};
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
var middlewares;
|
|
880
|
-
var hasRequiredMiddlewares;
|
|
881
|
-
function requireMiddlewares() {
|
|
882
|
-
if (hasRequiredMiddlewares) return middlewares;
|
|
883
|
-
hasRequiredMiddlewares = 1;
|
|
884
|
-
const middlewareIndexFactory = (db) => {
|
|
885
|
-
const verifyCategory2 = requireVerifyCategory()(db);
|
|
1014
|
+
const queryVerifier = new Verifier(queryValidatorConfig);
|
|
1015
|
+
const bodyVerifier = new Verifier(bodyValidatorConfig);
|
|
1016
|
+
const orderBodyVerifier = new Verifier(orderBodyValidatorConfig);
|
|
1017
|
+
const deleteBodyVerifier = new Verifier(deleteBodyValidatorConfig);
|
|
886
1018
|
return {
|
|
887
|
-
|
|
1019
|
+
// Верификация параметров запроса
|
|
1020
|
+
verifyQuery(req, res, next) {
|
|
1021
|
+
const verification = queryVerifier.verify(req.query);
|
|
1022
|
+
if (!verification.isValid) {
|
|
1023
|
+
return res.status(400).json({
|
|
1024
|
+
errors: verification.verificationErrors,
|
|
1025
|
+
message: "Invalid query parameters"
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
req.verifiedQuery = verification.verifiedData;
|
|
1029
|
+
next();
|
|
1030
|
+
},
|
|
1031
|
+
// Верификация тела запроса для создания/обновления категории
|
|
1032
|
+
verifyBody(req, res, next) {
|
|
1033
|
+
const verification = bodyVerifier.verify(req.body);
|
|
1034
|
+
if (!verification.isValid) {
|
|
1035
|
+
return res.status(400).json({
|
|
1036
|
+
errors: verification.verificationErrors,
|
|
1037
|
+
message: "Invalid request data"
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
req.verifiedBody = verification.verifiedData;
|
|
1041
|
+
next();
|
|
1042
|
+
},
|
|
1043
|
+
// Верификация тела запроса для обновления порядка категорий
|
|
1044
|
+
verifyOrderBody(req, res, next) {
|
|
1045
|
+
const verification = orderBodyVerifier.verify(req.body);
|
|
1046
|
+
if (!verification.isValid) {
|
|
1047
|
+
return res.status(400).json({
|
|
1048
|
+
errors: verification.verificationErrors,
|
|
1049
|
+
message: "Invalid request data"
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
req.verifiedBody = verification.verifiedData;
|
|
1053
|
+
next();
|
|
1054
|
+
},
|
|
1055
|
+
// Верификация тела запроса для удаления категории
|
|
1056
|
+
verifyDeleteBody(req, res, next) {
|
|
1057
|
+
const verification = deleteBodyVerifier.verify(req.body);
|
|
1058
|
+
if (!verification.isValid) {
|
|
1059
|
+
return res.status(400).json({
|
|
1060
|
+
errors: verification.verificationErrors,
|
|
1061
|
+
message: "Invalid request data"
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
req.verifiedBody = verification.verifiedData;
|
|
1065
|
+
next();
|
|
1066
|
+
},
|
|
1067
|
+
// Проверка на существование категории с тем же URL (для создания)
|
|
1068
|
+
async checkCategoryExistOrNot(req, res, next) {
|
|
1069
|
+
try {
|
|
1070
|
+
if (!req.verifiedBody.url) {
|
|
1071
|
+
return res.status(400).json({ message: "URL is required" });
|
|
1072
|
+
}
|
|
1073
|
+
const existingCategory = await db.category.findOne({ url: req.verifiedBody.url });
|
|
1074
|
+
if (existingCategory) {
|
|
1075
|
+
return res.status(409).json({
|
|
1076
|
+
message: "Category with this URL already exists",
|
|
1077
|
+
category: existingCategory
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
next();
|
|
1081
|
+
} catch (error) {
|
|
1082
|
+
res.status(500).json({ message: error.message });
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
// Загрузка категории для проверки ABAC (для обновления и удаления)
|
|
1086
|
+
async loadCategoryForUpdate(req, res, next) {
|
|
1087
|
+
try {
|
|
1088
|
+
const categoryId = req.verifiedBody._id;
|
|
1089
|
+
if (!categoryId) {
|
|
1090
|
+
return res.status(400).json({ message: "Category ID is required" });
|
|
1091
|
+
}
|
|
1092
|
+
const category = await db.category.findById(categoryId).lean();
|
|
1093
|
+
if (!category) {
|
|
1094
|
+
return res.status(404).json({ message: "Category not found" });
|
|
1095
|
+
}
|
|
1096
|
+
req.currentResource = category;
|
|
1097
|
+
next();
|
|
1098
|
+
} catch (error) {
|
|
1099
|
+
res.status(500).json({ message: error.message });
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
// Загрузка категории по URL для удаления
|
|
1103
|
+
async loadCategoryForDelete(req, res, next) {
|
|
1104
|
+
try {
|
|
1105
|
+
const url = req.verifiedBody.url;
|
|
1106
|
+
if (!url) {
|
|
1107
|
+
return res.status(400).json({ message: "Category URL is required" });
|
|
1108
|
+
}
|
|
1109
|
+
const category = await db.category.findOne({ url }).lean();
|
|
1110
|
+
if (!category) {
|
|
1111
|
+
return res.status(404).json({ message: "Category not found" });
|
|
1112
|
+
}
|
|
1113
|
+
req.currentResource = category;
|
|
1114
|
+
next();
|
|
1115
|
+
} catch (error) {
|
|
1116
|
+
res.status(500).json({ message: error.message });
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
888
1119
|
};
|
|
889
1120
|
};
|
|
890
|
-
|
|
891
|
-
return middlewares;
|
|
1121
|
+
return categories_verifier;
|
|
892
1122
|
}
|
|
893
1123
|
var hasRequiredCategories_routes;
|
|
894
1124
|
function requireCategories_routes() {
|
|
895
1125
|
if (hasRequiredCategories_routes) return categories_routes.exports;
|
|
896
1126
|
hasRequiredCategories_routes = 1;
|
|
897
1127
|
const controllerFactory = requireCategories_controller();
|
|
898
|
-
const
|
|
1128
|
+
const verifierFactory = requireCategories_verifier();
|
|
1129
|
+
const jwtFactory = authJwt.requireAuthJwt();
|
|
1130
|
+
const { getInstance } = globals_abac.requireGlobals_abac();
|
|
899
1131
|
categories_routes.exports = function(app, db) {
|
|
1132
|
+
const jwt = jwtFactory(db);
|
|
1133
|
+
const verifier = verifierFactory(db);
|
|
1134
|
+
const abac = getInstance(db);
|
|
900
1135
|
const controller = controllerFactory(db);
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1136
|
+
app.get(
|
|
1137
|
+
"/api/categories",
|
|
1138
|
+
jwt.verifyToken(true),
|
|
1139
|
+
verifier.verifyQuery,
|
|
1140
|
+
controller.read
|
|
1141
|
+
);
|
|
1142
|
+
app.post(
|
|
1143
|
+
"/api/categories/create",
|
|
1144
|
+
jwt.verifyToken(),
|
|
1145
|
+
verifier.verifyBody,
|
|
1146
|
+
verifier.checkCategoryExistOrNot,
|
|
1147
|
+
abac.middleware("category", "create"),
|
|
1148
|
+
controller.create
|
|
1149
|
+
);
|
|
1150
|
+
app.post(
|
|
1151
|
+
"/api/categories/update",
|
|
1152
|
+
jwt.verifyToken(),
|
|
1153
|
+
verifier.verifyBody,
|
|
1154
|
+
verifier.loadCategoryForUpdate,
|
|
1155
|
+
abac.middleware("category", "edit"),
|
|
1156
|
+
controller.update
|
|
1157
|
+
);
|
|
1158
|
+
app.post(
|
|
1159
|
+
"/api/categories/updateOrder",
|
|
1160
|
+
jwt.verifyToken(),
|
|
1161
|
+
verifier.verifyOrderBody,
|
|
1162
|
+
abac.middleware("category", "edit"),
|
|
1163
|
+
controller.updateOrder
|
|
1164
|
+
);
|
|
1165
|
+
app.post(
|
|
1166
|
+
"/api/categories/delete",
|
|
1167
|
+
jwt.verifyToken(),
|
|
1168
|
+
verifier.verifyDeleteBody,
|
|
1169
|
+
verifier.loadCategoryForDelete,
|
|
1170
|
+
abac.middleware("category", "delete"),
|
|
1171
|
+
controller.delete
|
|
1172
|
+
);
|
|
907
1173
|
};
|
|
908
1174
|
categories_routes.exports.controllerFactory = controllerFactory;
|
|
909
1175
|
return categories_routes.exports;
|