@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
|
@@ -1,40 +1,73 @@
|
|
|
1
|
+
// controllers/categories.controller.js
|
|
2
|
+
const globalsQuery = require('@martyrs/src/modules/globals/controllers/utils/queryProcessor');
|
|
3
|
+
const Logger = require('@martyrs/src/modules/globals/controllers/classes/globals.logger');
|
|
4
|
+
const Cache = require('@martyrs/src/modules/globals/controllers/classes/globals.cache');
|
|
5
|
+
|
|
1
6
|
const controllerFactory = (db) => {
|
|
2
7
|
const Category = db.category;
|
|
8
|
+
const logger = new Logger(db);
|
|
9
|
+
const cache = new Cache();
|
|
3
10
|
|
|
4
11
|
return {
|
|
5
12
|
async read(req, res) {
|
|
6
13
|
try {
|
|
7
|
-
|
|
14
|
+
// Используем верифицированные данные из middleware
|
|
15
|
+
const {
|
|
8
16
|
parent,
|
|
9
17
|
url,
|
|
10
18
|
search,
|
|
11
|
-
sortParam
|
|
12
|
-
sortOrder
|
|
13
|
-
skip
|
|
14
|
-
limit
|
|
15
|
-
excludeChildren
|
|
16
|
-
rootOnly
|
|
17
|
-
|
|
19
|
+
sortParam,
|
|
20
|
+
sortOrder,
|
|
21
|
+
skip,
|
|
22
|
+
limit,
|
|
23
|
+
excludeChildren,
|
|
24
|
+
rootOnly,
|
|
25
|
+
type
|
|
26
|
+
} = req.verifiedQuery;
|
|
27
|
+
|
|
28
|
+
// Формируем ключ кэша
|
|
29
|
+
const cacheKey = JSON.stringify(req.verifiedQuery);
|
|
30
|
+
|
|
31
|
+
// Проверяем наличие данных в кэше
|
|
32
|
+
let cachedResult = await cache.get(cacheKey);
|
|
33
|
+
if (cachedResult) {
|
|
34
|
+
return res.status(200).json(cachedResult);
|
|
35
|
+
}
|
|
18
36
|
|
|
19
37
|
// Создаем условия для выборки категорий
|
|
20
38
|
const matchStage = {
|
|
21
39
|
...(req.query.status && { status: req.query.status }),
|
|
22
|
-
...(
|
|
40
|
+
...(url && { url: url }),
|
|
23
41
|
...(search && { name: { $regex: search, $options: 'i' } }),
|
|
24
42
|
...(parent ? { parent: new db.mongoose.Types.ObjectId(parent) } : {}),
|
|
25
43
|
...(rootOnly === 'true' && !search ? { parent: null } : {})
|
|
26
44
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
|
|
46
|
+
// Добавляем фильтрацию по типу владельца
|
|
47
|
+
if (type === 'platform') {
|
|
48
|
+
matchStage['owner.type'] = 'platform';
|
|
49
|
+
} else if (type === 'organization' && req.query.organizationId) {
|
|
50
|
+
matchStage['owner.type'] = 'organization';
|
|
51
|
+
matchStage['owner.target'] = new db.mongoose.Types.ObjectId(req.query.organizationId);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (search) {
|
|
55
|
+
excludeChildren = 'true';
|
|
56
|
+
}
|
|
31
57
|
|
|
32
58
|
// Базовый пайплайн для получения категорий
|
|
33
59
|
const pipeline = [
|
|
34
60
|
{ $match: matchStage },
|
|
61
|
+
globalsQuery.getCreatorUserLookupStage(),
|
|
62
|
+
globalsQuery.getCreatorOrganizationLookupStage(),
|
|
63
|
+
// For owner
|
|
64
|
+
globalsQuery.getOwnerUserLookupStage(),
|
|
65
|
+
globalsQuery.getOwnerOrganizationLookupStage(),
|
|
66
|
+
globalsQuery.getAddFieldsCreatorOwnerStage(),
|
|
35
67
|
{ $sort: { [sortParam]: sortOrder === 'asc' ? 1 : -1 } },
|
|
36
68
|
{ $skip: Number(skip) },
|
|
37
69
|
{ $limit: Number(limit) },
|
|
70
|
+
globalsQuery.removeTempPropeties()
|
|
38
71
|
];
|
|
39
72
|
|
|
40
73
|
// Если дочерние категории не исключаются, добавляем этап для получения потомков
|
|
@@ -54,126 +87,113 @@ const controllerFactory = (db) => {
|
|
|
54
87
|
// Выполняем агрегацию
|
|
55
88
|
const results = await Category.aggregate(pipeline);
|
|
56
89
|
|
|
90
|
+
let response;
|
|
57
91
|
// Если исключаем дочерние категории, просто возвращаем результаты
|
|
58
92
|
if (excludeChildren === 'true') {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Объединяем все категории и их потомков в один массив
|
|
65
|
-
const allCategories = [];
|
|
66
|
-
|
|
67
|
-
results.forEach(doc => {
|
|
68
|
-
// Добавляем текущую категорию (без allDescendants)
|
|
69
|
-
const category = { ...doc };
|
|
70
|
-
delete category.allDescendants;
|
|
71
|
-
allCategories.push(category);
|
|
93
|
+
response = results;
|
|
94
|
+
} else {
|
|
95
|
+
// Объединяем все категории и их потомков в один массив
|
|
96
|
+
const allCategories = [];
|
|
72
97
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// Удаляем дубликаты категорий по ID
|
|
80
|
-
const uniqueCategories = Array.from(
|
|
81
|
-
new Map(allCategories.map(item => [item._id.toString(), item])).values()
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
// Строим дерево категорий
|
|
85
|
-
const tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
|
|
86
|
-
|
|
87
|
-
// Функция для построения дерева категорий с использованием паттерна Adjacency List
|
|
88
|
-
function buildAdjacencyTree(categories, sortParam, sortOrder) {
|
|
89
|
-
// Создаем карту категорий по ID для быстрого доступа
|
|
90
|
-
const categoryMap = new Map();
|
|
91
|
-
|
|
92
|
-
// Инициализируем каждую категорию с пустым массивом children
|
|
93
|
-
categories.forEach(category => {
|
|
94
|
-
categoryMap.set(category._id.toString(), {
|
|
95
|
-
...category,
|
|
96
|
-
children: []
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Строим дерево, связывая родительские и дочерние категории
|
|
101
|
-
const rootCategories = [];
|
|
102
|
-
|
|
103
|
-
categories.forEach(category => {
|
|
104
|
-
const categoryWithChildren = categoryMap.get(category._id.toString());
|
|
98
|
+
results.forEach(doc => {
|
|
99
|
+
// Добавляем текущую категорию (без allDescendants)
|
|
100
|
+
const category = { ...doc };
|
|
101
|
+
delete category.allDescendants;
|
|
102
|
+
allCategories.push(category);
|
|
105
103
|
|
|
106
|
-
//
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
parentCategory.children.push(categoryWithChildren);
|
|
110
|
-
}
|
|
111
|
-
// Иначе это корневая категория
|
|
112
|
-
else if (!category.parent) {
|
|
113
|
-
rootCategories.push(categoryWithChildren);
|
|
104
|
+
// Добавляем потомков, если они есть
|
|
105
|
+
if (doc.allDescendants && doc.allDescendants.length > 0) {
|
|
106
|
+
allCategories.push(...doc.allDescendants);
|
|
114
107
|
}
|
|
115
108
|
});
|
|
116
109
|
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Сортируем текущий уровень
|
|
124
|
-
nodes.sort((a, b) => {
|
|
125
|
-
const valueA = a[sortParam] ?? (sortParam === 'order' ? Number.MAX_SAFE_INTEGER : '');
|
|
126
|
-
const valueB = b[sortParam] ?? (sortParam === 'order' ? Number.MAX_SAFE_INTEGER : '');
|
|
127
|
-
|
|
128
|
-
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
129
|
-
return sortOrder === 'asc' ? valueA - valueB : valueB - valueA;
|
|
130
|
-
} else {
|
|
131
|
-
const stringA = String(valueA);
|
|
132
|
-
const stringB = String(valueB);
|
|
133
|
-
return sortOrder === 'asc' ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// Рекурсивно сортируем дочерние категории
|
|
138
|
-
nodes.forEach(node => {
|
|
139
|
-
if (node.children && node.children.length > 0) {
|
|
140
|
-
sortCategories(node.children);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
return nodes;
|
|
145
|
-
}
|
|
110
|
+
// Удаляем дубликаты категорий по ID
|
|
111
|
+
const uniqueCategories = Array.from(
|
|
112
|
+
new Map(allCategories.map(item => [item._id.toString(), item])).values()
|
|
113
|
+
);
|
|
146
114
|
|
|
147
|
-
//
|
|
148
|
-
|
|
115
|
+
// Строим дерево категорий
|
|
116
|
+
const tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
|
|
117
|
+
|
|
118
|
+
// Если rootOnly=true, возвращаем все корневые категории из дерева
|
|
119
|
+
if (rootOnly === 'true') {
|
|
120
|
+
response = tree;
|
|
121
|
+
} else {
|
|
122
|
+
// Иначе возвращаем только те корневые категории, которые соответствуют запросу
|
|
123
|
+
const requestedCategoryIds = results.map(r => r._id.toString());
|
|
124
|
+
response = tree.filter(category =>
|
|
125
|
+
requestedCategoryIds.includes(category._id.toString())
|
|
126
|
+
);
|
|
127
|
+
}
|
|
149
128
|
}
|
|
150
129
|
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const requestedCategoryIds = results.map(r => r._id.toString());
|
|
158
|
-
const filteredTree = tree.filter(category =>
|
|
159
|
-
requestedCategoryIds.includes(category._id.toString())
|
|
160
|
-
);
|
|
161
|
-
res.status(200).json(filteredTree);
|
|
130
|
+
// Кэшируем результат с тегами для каждой категории
|
|
131
|
+
const tags = ['categories'];
|
|
132
|
+
|
|
133
|
+
// Добавляем тег для категорий организации, если применимо
|
|
134
|
+
if (type === 'organization' && req.query.organizationId) {
|
|
135
|
+
tags.push(`organization_${req.query.organizationId}`);
|
|
162
136
|
}
|
|
137
|
+
|
|
138
|
+
// Добавляем теги для отдельных категорий
|
|
139
|
+
for (const cat of response) {
|
|
140
|
+
if (cat._id) {
|
|
141
|
+
tags.push(`category_${cat._id}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
await cache.setWithTags(cacheKey, response, tags);
|
|
146
|
+
|
|
147
|
+
res.status(200).json(response);
|
|
163
148
|
} catch (err) {
|
|
149
|
+
logger.error(`Error reading categories: ${err.message}`);
|
|
164
150
|
res.status(500).json({ message: err.message });
|
|
165
151
|
}
|
|
166
152
|
},
|
|
167
153
|
|
|
168
154
|
async create(req, res) {
|
|
169
155
|
try {
|
|
156
|
+
// Используем верифицированные данные из middleware
|
|
157
|
+
const categoryData = req.verifiedBody;
|
|
158
|
+
|
|
159
|
+
// Если creator не задан, используем текущего пользователя
|
|
160
|
+
if (!categoryData.creator && req.userId) {
|
|
161
|
+
categoryData.creator = {
|
|
162
|
+
type: 'user',
|
|
163
|
+
target: req.userId
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Если owner не задан, определяем по типу
|
|
168
|
+
if (!categoryData.owner) {
|
|
169
|
+
// Если задан organizationId, то владельцем будет организация
|
|
170
|
+
if (req.query.organizationId) {
|
|
171
|
+
categoryData.owner = {
|
|
172
|
+
type: 'organization',
|
|
173
|
+
target: req.query.organizationId
|
|
174
|
+
};
|
|
175
|
+
} else {
|
|
176
|
+
// Иначе это платформенная категория
|
|
177
|
+
categoryData.owner = {
|
|
178
|
+
type: 'platform',
|
|
179
|
+
target: null
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
170
184
|
const highestOrder = await Category.findOne().sort('-order');
|
|
171
185
|
const order = highestOrder ? highestOrder.order + 1 : 1;
|
|
172
|
-
|
|
186
|
+
|
|
187
|
+
// Создаем категорию
|
|
188
|
+
const category = new Category({
|
|
189
|
+
...categoryData,
|
|
190
|
+
order
|
|
191
|
+
});
|
|
173
192
|
|
|
174
|
-
|
|
193
|
+
// Обрабатываем родительскую категорию
|
|
194
|
+
if (categoryData.parent) {
|
|
175
195
|
const parent = await Category.findByIdAndUpdate(
|
|
176
|
-
|
|
196
|
+
categoryData.parent,
|
|
177
197
|
{ $push: { children: category._id } },
|
|
178
198
|
{ new: true }
|
|
179
199
|
);
|
|
@@ -181,49 +201,71 @@ const controllerFactory = (db) => {
|
|
|
181
201
|
category.parent = parent._id;
|
|
182
202
|
}
|
|
183
203
|
|
|
184
|
-
|
|
204
|
+
// Обрабатываем дочерние категории
|
|
205
|
+
if (categoryData.children && categoryData.children.length > 0) {
|
|
185
206
|
await Category.updateMany(
|
|
186
|
-
{ _id: { $in:
|
|
207
|
+
{ _id: { $in: categoryData.children } },
|
|
187
208
|
{ $set: { parent: category._id } }
|
|
188
209
|
);
|
|
189
210
|
}
|
|
190
211
|
|
|
191
212
|
await category.save();
|
|
213
|
+
|
|
214
|
+
// Очищаем кэш для категорий
|
|
215
|
+
await cache.delByTags(['categories']);
|
|
216
|
+
|
|
217
|
+
// Если категория принадлежит организации, очищаем ее кэш
|
|
218
|
+
if (category.owner.type === 'organization') {
|
|
219
|
+
await cache.delByTag(`organization_${category.owner.target}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
logger.info(`Category created: ${category._id}`);
|
|
192
223
|
res.status(201).json(category);
|
|
193
224
|
} catch (err) {
|
|
225
|
+
logger.error(`Error creating category: ${err.message}`);
|
|
194
226
|
res.status(err.message === 'Parent category not found' ? 404 : 500).json({ message: err.message });
|
|
195
227
|
}
|
|
196
228
|
},
|
|
197
229
|
|
|
198
230
|
async update(req, res) {
|
|
199
231
|
try {
|
|
200
|
-
|
|
232
|
+
// Используем верифицированные данные из middleware
|
|
233
|
+
const category = req.verifiedBody;
|
|
201
234
|
|
|
202
|
-
if (!category || !category._id) {
|
|
203
|
-
return res.status(400).json({ message: 'Category ID is required' });
|
|
204
|
-
}
|
|
205
|
-
|
|
206
235
|
const updatedCategory = await Category.findByIdAndUpdate(
|
|
207
236
|
category._id,
|
|
208
237
|
{ $set: category },
|
|
209
238
|
{ new: true }
|
|
210
239
|
).lean();
|
|
211
240
|
|
|
241
|
+
// Категория уже проверена middleware, но на всякий случай перепроверим
|
|
212
242
|
if (!updatedCategory) {
|
|
213
243
|
return res.status(404).json({ message: 'Category not found' });
|
|
214
244
|
}
|
|
215
|
-
|
|
245
|
+
|
|
246
|
+
// Очищаем кэш для этой категории
|
|
247
|
+
await cache.delByTag(`category_${category._id}`);
|
|
248
|
+
|
|
249
|
+
// Очищаем кэш для категорий
|
|
250
|
+
await cache.delByTags(['categories']);
|
|
251
|
+
|
|
252
|
+
// Если категория принадлежит организации, очищаем ее кэш
|
|
253
|
+
if (updatedCategory.owner && updatedCategory.owner.type === 'organization') {
|
|
254
|
+
await cache.delByTag(`organization_${updatedCategory.owner.target}`);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
logger.info(`Category updated: ${category._id}`);
|
|
216
258
|
res.status(200).json(updatedCategory);
|
|
217
259
|
} catch (err) {
|
|
218
|
-
|
|
260
|
+
logger.error(`Category update error: ${err.message}`);
|
|
219
261
|
res.status(500).json({ message: 'Failed to update category' });
|
|
220
262
|
}
|
|
221
263
|
},
|
|
222
264
|
|
|
223
265
|
async updateOrder(req, res) {
|
|
224
|
-
|
|
225
266
|
try {
|
|
226
|
-
|
|
267
|
+
// Используем верифицированные данные из middleware
|
|
268
|
+
const { categories } = req.verifiedBody;
|
|
227
269
|
|
|
228
270
|
const bulkOps = categories.map(category => ({
|
|
229
271
|
updateOne: {
|
|
@@ -238,24 +280,67 @@ const controllerFactory = (db) => {
|
|
|
238
280
|
}));
|
|
239
281
|
|
|
240
282
|
await Category.bulkWrite(bulkOps);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
283
|
+
|
|
284
|
+
// Собираем ID категорий и организаций для очистки кэша
|
|
285
|
+
const categoryIds = categories.map(cat => cat._id);
|
|
286
|
+
const organizationIds = new Set();
|
|
287
|
+
|
|
288
|
+
// Получаем категории, чтобы выяснить, к каким организациям они принадлежат
|
|
289
|
+
const updatedCategories = await Category.find({ _id: { $in: categoryIds } }).lean();
|
|
290
|
+
|
|
291
|
+
// Собираем ID организаций
|
|
292
|
+
updatedCategories.forEach(cat => {
|
|
293
|
+
if (cat.owner && cat.owner.type === 'organization') {
|
|
294
|
+
organizationIds.add(cat.owner.target.toString());
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Очищаем кэш для категорий
|
|
299
|
+
await cache.delByTags(['categories']);
|
|
300
|
+
|
|
301
|
+
// Очищаем кэш для отдельных категорий
|
|
302
|
+
for (const catId of categoryIds) {
|
|
303
|
+
await cache.delByTag(`category_${catId}`);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Очищаем кэш для организаций
|
|
307
|
+
for (const orgId of organizationIds) {
|
|
308
|
+
await cache.delByTag(`organization_${orgId}`);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Получаем обновленные категории с учетом типа владельца
|
|
312
|
+
let query = {};
|
|
313
|
+
if (req.query.type === 'platform') {
|
|
314
|
+
query = { 'owner.type': 'platform' };
|
|
315
|
+
} else if (req.query.type === 'organization' && req.query.organizationId) {
|
|
316
|
+
query = {
|
|
317
|
+
'owner.type': 'organization',
|
|
318
|
+
'owner.target': new db.mongoose.Types.ObjectId(req.query.organizationId)
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const result = await Category.find(query).sort({ order: 'asc' }).lean();
|
|
323
|
+
|
|
324
|
+
logger.info(`Categories order updated: ${categoryIds.join(', ')}`);
|
|
325
|
+
res.status(200).json(result);
|
|
244
326
|
} catch (err) {
|
|
245
|
-
|
|
246
|
-
res.status(500).json({ message: 'Failed to update categories' });
|
|
327
|
+
logger.error(`Category order update error: ${err.message}`);
|
|
328
|
+
res.status(500).json({ message: 'Failed to update categories order' });
|
|
247
329
|
}
|
|
248
330
|
},
|
|
249
331
|
|
|
250
332
|
async delete(req, res) {
|
|
251
333
|
try {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
334
|
+
// Категория уже загружена middleware
|
|
335
|
+
const category = req.currentResource;
|
|
336
|
+
|
|
337
|
+
// Сохраняем организацию владельца для очистки кэша
|
|
338
|
+
let ownerOrgId = null;
|
|
339
|
+
if (category.owner && category.owner.type === 'organization') {
|
|
340
|
+
ownerOrgId = category.owner.target;
|
|
256
341
|
}
|
|
257
342
|
|
|
258
|
-
// Используем $graphLookup для поиска всех потомков
|
|
343
|
+
// Используем $graphLookup для поиска всех потомков
|
|
259
344
|
const result = await Category.aggregate([
|
|
260
345
|
{ $match: { _id: category._id } },
|
|
261
346
|
{
|
|
@@ -275,16 +360,95 @@ const controllerFactory = (db) => {
|
|
|
275
360
|
// Собираем id текущей категории и всех найденных потомков
|
|
276
361
|
const idsToDelete = [category._id, ...((result[0]?.descendants || []).map(({ _id }) => _id))];
|
|
277
362
|
|
|
363
|
+
// Собираем ID для очистки кэша
|
|
364
|
+
const categoryIdsTags = idsToDelete.map(id => `category_${id}`);
|
|
365
|
+
|
|
278
366
|
// Удаляем все категории одним запросом
|
|
279
367
|
await Category.deleteMany({ _id: { $in: idsToDelete } });
|
|
280
368
|
|
|
369
|
+
// Очищаем кэш для категорий
|
|
370
|
+
await cache.delByTags(['categories']);
|
|
371
|
+
|
|
372
|
+
// Очищаем кэш для отдельных категорий
|
|
373
|
+
await cache.delByTags(categoryIdsTags);
|
|
374
|
+
|
|
375
|
+
// Очищаем кэш для организации, если категория ей принадлежала
|
|
376
|
+
if (ownerOrgId) {
|
|
377
|
+
await cache.delByTag(`organization_${ownerOrgId}`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
logger.info(`Category and its subcategories deleted: ${category.url}`);
|
|
281
381
|
res.status(200).json({ message: 'Category and its subcategories deleted successfully' });
|
|
282
382
|
} catch (err) {
|
|
283
|
-
|
|
383
|
+
logger.error(`Error deleting category: ${err.message}`);
|
|
284
384
|
res.status(500).json({ message: err.message || 'Internal server error' });
|
|
285
385
|
}
|
|
286
386
|
}
|
|
287
387
|
};
|
|
388
|
+
|
|
389
|
+
// Вспомогательная функция для построения дерева категорий
|
|
390
|
+
function buildAdjacencyTree(categories, sortParam, sortOrder) {
|
|
391
|
+
// Создаем карту категорий по ID для быстрого доступа
|
|
392
|
+
const categoryMap = new Map();
|
|
393
|
+
|
|
394
|
+
// Инициализируем каждую категорию с пустым массивом children
|
|
395
|
+
categories.forEach(category => {
|
|
396
|
+
categoryMap.set(category._id.toString(), {
|
|
397
|
+
...category,
|
|
398
|
+
children: []
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// Строим дерево, связывая родительские и дочерние категории
|
|
403
|
+
const rootCategories = [];
|
|
404
|
+
|
|
405
|
+
categories.forEach(category => {
|
|
406
|
+
const categoryWithChildren = categoryMap.get(category._id.toString());
|
|
407
|
+
|
|
408
|
+
// Если у категории есть родитель и этот родитель есть в нашей карте
|
|
409
|
+
if (category.parent && categoryMap.has(category.parent.toString())) {
|
|
410
|
+
const parentCategory = categoryMap.get(category.parent.toString());
|
|
411
|
+
parentCategory.children.push(categoryWithChildren);
|
|
412
|
+
}
|
|
413
|
+
// Иначе это корневая категория
|
|
414
|
+
else if (!category.parent) {
|
|
415
|
+
rootCategories.push(categoryWithChildren);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// Рекурсивная функция для сортировки категорий на всех уровнях
|
|
420
|
+
function sortCategories(nodes) {
|
|
421
|
+
if (!nodes || nodes.length === 0) {
|
|
422
|
+
return nodes;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Сортируем текущий уровень
|
|
426
|
+
nodes.sort((a, b) => {
|
|
427
|
+
const valueA = a[sortParam] ?? (sortParam === 'order' ? Number.MAX_SAFE_INTEGER : '');
|
|
428
|
+
const valueB = b[sortParam] ?? (sortParam === 'order' ? Number.MAX_SAFE_INTEGER : '');
|
|
429
|
+
|
|
430
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
431
|
+
return sortOrder === 'asc' ? valueA - valueB : valueB - valueA;
|
|
432
|
+
} else {
|
|
433
|
+
const stringA = String(valueA);
|
|
434
|
+
const stringB = String(valueB);
|
|
435
|
+
return sortOrder === 'asc' ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
// Рекурсивно сортируем дочерние категории
|
|
440
|
+
nodes.forEach(node => {
|
|
441
|
+
if (node.children && node.children.length > 0) {
|
|
442
|
+
sortCategories(node.children);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
return nodes;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Сортируем категории на всех уровнях и возвращаем результат
|
|
450
|
+
return sortCategories(rootCategories);
|
|
451
|
+
}
|
|
288
452
|
};
|
|
289
453
|
|
|
290
454
|
module.exports = controllerFactory;
|