@ozdao/martyrs 0.2.485 → 0.2.487
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-B2jWzwLB.cjs +1 -0
- package/dist/{Media-DlUBwVWs.js → Media-DZ5_ItXQ.js} +3 -3
- package/dist/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +4 -4
- package/dist/_virtual/index2.js +4 -4
- package/dist/auth.server.cjs +3 -24
- package/dist/auth.server.js +2 -23
- package/dist/{authJwt-DBB51Iql.cjs → authJwt-D35KyJlE.cjs} +31 -2
- package/dist/{authJwt-DcYNNwcr.js → authJwt-DqxhUym0.js} +31 -2
- package/dist/chats.server.cjs +1 -1
- package/dist/chats.server.js +1 -1
- package/dist/community.server.cjs +1 -1
- package/dist/community.server.js +1 -1
- package/dist/crud-BDIArc5A.cjs +1096 -0
- package/dist/crud-DJvpe0aZ.js +1097 -0
- package/dist/events.server.cjs +1 -1
- package/dist/events.server.js +1 -1
- package/dist/files.server.cjs +1 -1
- package/dist/files.server.js +1 -1
- package/dist/gallery.server.cjs +1 -1
- package/dist/gallery.server.js +1 -1
- package/dist/globals.server.cjs +3 -322
- package/dist/globals.server.js +1 -303
- package/dist/globals.websocket-DzvdIBf6.js +306 -0
- package/dist/globals.websocket-k6_B1T7k.cjs +322 -0
- package/dist/{index-CsJwdsBW.js → index-CVuQC4k1.js} +1 -1
- package/dist/{index-YNOkL1mu.cjs → index-DiSKVCaA.cjs} +1 -1
- package/dist/main-C6_DPWGX.cjs +11 -0
- package/dist/{main-CK6rC5Sz.js → main-nQmkbWsW.js} +2291 -2224
- package/dist/martyrs/src/components/Button/{Button.vue2.cjs → Button.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Button/{Button.vue2.js.map → Button.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Button/{Button.vue2.js → Button.vue.js} +2 -2
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -0
- package/dist/martyrs/src/components/{DatePicker → Calendar}/Calendar.vue.cjs +1 -1
- package/dist/martyrs/src/components/Calendar/Calendar.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/{DatePicker → Calendar}/Calendar.vue.js +1 -1
- package/dist/martyrs/src/components/Calendar/Calendar.vue.js.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue2.cjs → Chips.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue2.js → Chips.vue.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +1 -0
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/Field/{Field.vue.cjs → Field.vue2.cjs} +5 -6
- package/dist/martyrs/src/components/Field/Field.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Field/{Field.vue.js → Field.vue2.js} +5 -6
- package/dist/martyrs/src/components/Field/Field.vue2.js.map +1 -0
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.cjs +10 -9
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.js +13 -12
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.js +1 -1
- package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +1 -1
- package/dist/martyrs/src/components/Media/Media.vue.cjs +2 -2
- package/dist/martyrs/src/components/Media/Media.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Media/Media.vue.js +2 -2
- package/dist/martyrs/src/components/Media/Media.vue.js.map +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/Popup/{Popup.vue2.cjs → Popup.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Popup/{Popup.vue2.js.map → Popup.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Popup/{Popup.vue2.js → Popup.vue.js} +2 -2
- package/dist/martyrs/src/components/Popup/Popup.vue.js.map +1 -0
- package/dist/martyrs/src/components/Select/Select.vue.cjs +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.js +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.cjs +1 -0
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.js +1 -0
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.js.map +1 -1
- 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 +5 -5
- 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 +5 -5
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +3 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +3 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.js +10 -10
- 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 +4 -4
- 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 +5 -5
- 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 +4 -4
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +23 -23
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +3 -3
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +3 -3
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +4 -4
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +13 -13
- package/dist/martyrs/src/modules/constructor/components/elements/Card.vue.cjs +1 -1
- package/dist/martyrs/src/modules/constructor/components/elements/Card.vue.js +3 -3
- package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/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 +3 -3
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +25 -25
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +3 -3
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +16 -16
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +9 -2
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +9 -2
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +4 -3
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +4 -3
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs +24 -58
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.js +24 -58
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/AlertDialog.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/AlertDialog.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockSearch.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +2 -2
- 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/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/Filters.vue2.cjs +2 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Filters.vue2.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Filters.vue2.js +2 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Filters.vue2.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/filters/FilterOptions.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/filters/FilterOptions.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/sections/filters/FilterPrice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/filters/FilterPrice.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/store/globals.cjs +6 -0
- package/dist/martyrs/src/modules/globals/views/store/globals.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/store/globals.js +6 -0
- package/dist/martyrs/src/modules/globals/views/store/globals.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/axios-instance.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/axios-instance.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/query-serializer.cjs +100 -0
- package/dist/martyrs/src/modules/globals/views/utils/query-serializer.cjs.map +1 -0
- package/dist/martyrs/src/modules/globals/views/utils/query-serializer.js +100 -0
- package/dist/martyrs/src/modules/globals/views/utils/query-serializer.js.map +1 -0
- package/dist/martyrs/src/modules/icons/components/IconSearchPopup.vue.cjs +224 -0
- package/dist/martyrs/src/modules/icons/components/IconSearchPopup.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/icons/components/IconSearchPopup.vue.js +224 -0
- package/dist/martyrs/src/modules/icons/components/IconSearchPopup.vue.js.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconAddress.vue.cjs +40 -0
- package/dist/martyrs/src/modules/icons/entities/IconAddress.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconAddress.vue.js +40 -0
- package/dist/martyrs/src/modules/icons/entities/IconAddress.vue.js.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconDate.vue.cjs +6 -6
- package/dist/martyrs/src/modules/icons/entities/IconDate.vue.js +6 -6
- package/dist/martyrs/src/modules/icons/entities/IconEmail.vue.cjs +32 -0
- package/dist/martyrs/src/modules/icons/entities/IconEmail.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconEmail.vue.js +32 -0
- package/dist/martyrs/src/modules/icons/entities/IconEmail.vue.js.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.cjs +10 -12
- package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.js +11 -13
- package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconPhone.vue.cjs +32 -0
- package/dist/martyrs/src/modules/icons/entities/IconPhone.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/icons/entities/IconPhone.vue.js +32 -0
- package/dist/martyrs/src/modules/icons/entities/IconPhone.vue.js.map +1 -0
- package/dist/martyrs/src/modules/icons/icons.client.cjs +48 -4
- package/dist/martyrs/src/modules/icons/icons.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/icons.client.js +172 -128
- package/dist/martyrs/src/modules/icons/icons.client.js.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconCross.vue.cjs +5 -7
- package/dist/martyrs/src/modules/icons/navigation/IconCross.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconCross.vue.js +5 -7
- package/dist/martyrs/src/modules/icons/navigation/IconCross.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.cjs +6 -11
- package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.js +6 -11
- package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.cjs +6 -11
- package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.js +6 -11
- package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs +62 -6
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.js +189 -133
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/dribbble.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/dribbble.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/dribbble.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/dribbble.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/facebook.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/facebook.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/facebook.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/facebook.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/instagram.vue.cjs +25 -17
- package/dist/martyrs/src/modules/icons/socials/instagram.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/instagram.vue.js +25 -17
- package/dist/martyrs/src/modules/icons/socials/instagram.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/line.vue.cjs +23 -14
- package/dist/martyrs/src/modules/icons/socials/line.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/line.vue.js +23 -14
- package/dist/martyrs/src/modules/icons/socials/line.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/linkedin.vue.cjs +26 -17
- package/dist/martyrs/src/modules/icons/socials/linkedin.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/linkedin.vue.js +26 -17
- package/dist/martyrs/src/modules/icons/socials/linkedin.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/reddit.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/reddit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/reddit.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/reddit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/telegram.vue.cjs +29 -20
- package/dist/martyrs/src/modules/icons/socials/telegram.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/telegram.vue.js +29 -20
- package/dist/martyrs/src/modules/icons/socials/telegram.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/twitter.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/twitter.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/twitter.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/twitter.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/vk.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/vk.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/vk.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/vk.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/whatsapp.vue.cjs +32 -0
- package/dist/martyrs/src/modules/icons/socials/whatsapp.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/icons/socials/whatsapp.vue.js +32 -0
- package/dist/martyrs/src/modules/icons/socials/whatsapp.vue.js.map +1 -0
- package/dist/martyrs/src/modules/icons/socials/youtube.vue.cjs +21 -12
- package/dist/martyrs/src/modules/icons/socials/youtube.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/socials/youtube.vue.js +21 -12
- package/dist/martyrs/src/modules/icons/socials/youtube.vue.js.map +1 -1
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.cjs +87 -0
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.js +87 -0
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/ArtistCard.vue.cjs +83 -0
- package/dist/martyrs/src/modules/music/components/cards/ArtistCard.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/ArtistCard.vue.js +83 -0
- package/dist/martyrs/src/modules/music/components/cards/ArtistCard.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.cjs +83 -0
- package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.js +83 -0
- package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackCard.vue.cjs +68 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackCard.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackCard.vue.js +68 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackCard.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.cjs +162 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.js +162 -0
- package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs +437 -0
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +437 -0
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +416 -0
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +416 -0
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.cjs +174 -0
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js +174 -0
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.cjs +80 -0
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.js +80 -0
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs +554 -0
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +554 -0
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.cjs +104 -0
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.js +104 -0
- package/dist/martyrs/src/modules/music/components/layouts/MusicLayout.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +314 -0
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +314 -0
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumCreate.vue.cjs +14 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumCreate.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumCreate.vue.js +14 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumCreate.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumEdit.vue.cjs +23 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumEdit.vue.js +23 -0
- package/dist/martyrs/src/modules/music/components/pages/AlbumEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.cjs +467 -0
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.js +467 -0
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistCreate.vue.cjs +14 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistCreate.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistCreate.vue.js +14 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistCreate.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistEdit.vue.cjs +23 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistEdit.vue.js +23 -0
- package/dist/martyrs/src/modules/music/components/pages/ArtistEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicHome.vue.cjs +256 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicHome.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicHome.vue.js +256 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicHome.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.cjs +248 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.js +248 -0
- package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +580 -0
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +580 -0
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistCreate.vue.cjs +14 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistCreate.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistCreate.vue.js +14 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistCreate.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistEdit.vue.cjs +23 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistEdit.vue.js +23 -0
- package/dist/martyrs/src/modules/music/components/pages/PlaylistEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.cjs +473 -0
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.js +473 -0
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +111 -0
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +111 -0
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.cjs +28 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.js +28 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackEdit.vue.cjs +23 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackEdit.vue.js +23 -0
- package/dist/martyrs/src/modules/music/components/pages/TrackEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.cjs +227 -0
- package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.js +227 -0
- package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/TrackProgress.vue.cjs +85 -0
- package/dist/martyrs/src/modules/music/components/player/TrackProgress.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/TrackProgress.vue.js +85 -0
- package/dist/martyrs/src/modules/music/components/player/TrackProgress.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/VolumeControl.vue.cjs +71 -0
- package/dist/martyrs/src/modules/music/components/player/VolumeControl.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/components/player/VolumeControl.vue.js +71 -0
- package/dist/martyrs/src/modules/music/components/player/VolumeControl.vue.js.map +1 -0
- package/dist/martyrs/src/modules/music/music.client.cjs +137 -0
- package/dist/martyrs/src/modules/music/music.client.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/music.client.js +137 -0
- package/dist/martyrs/src/modules/music/music.client.js.map +1 -0
- package/dist/martyrs/src/modules/music/router/albums.cjs +34 -0
- package/dist/martyrs/src/modules/music/router/albums.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/router/albums.js +34 -0
- package/dist/martyrs/src/modules/music/router/albums.js.map +1 -0
- package/dist/martyrs/src/modules/music/router/artists.cjs +34 -0
- package/dist/martyrs/src/modules/music/router/artists.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/router/artists.js +34 -0
- package/dist/martyrs/src/modules/music/router/artists.js.map +1 -0
- package/dist/martyrs/src/modules/music/router/music.cjs +47 -0
- package/dist/martyrs/src/modules/music/router/music.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/router/music.js +47 -0
- package/dist/martyrs/src/modules/music/router/music.js.map +1 -0
- package/dist/martyrs/src/modules/music/router/playlists.cjs +34 -0
- package/dist/martyrs/src/modules/music/router/playlists.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/router/playlists.js +34 -0
- package/dist/martyrs/src/modules/music/router/playlists.js.map +1 -0
- package/dist/martyrs/src/modules/music/router/tracks.cjs +34 -0
- package/dist/martyrs/src/modules/music/router/tracks.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/router/tracks.js +34 -0
- package/dist/martyrs/src/modules/music/router/tracks.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/albums.cjs +167 -0
- package/dist/martyrs/src/modules/music/store/albums.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/albums.js +167 -0
- package/dist/martyrs/src/modules/music/store/albums.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/artists.cjs +160 -0
- package/dist/martyrs/src/modules/music/store/artists.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/artists.js +160 -0
- package/dist/martyrs/src/modules/music/store/artists.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/genres.cjs +123 -0
- package/dist/martyrs/src/modules/music/store/genres.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/genres.js +123 -0
- package/dist/martyrs/src/modules/music/store/genres.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/player.cjs +297 -0
- package/dist/martyrs/src/modules/music/store/player.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/player.js +297 -0
- package/dist/martyrs/src/modules/music/store/player.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/playlists.cjs +182 -0
- package/dist/martyrs/src/modules/music/store/playlists.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/playlists.js +182 -0
- package/dist/martyrs/src/modules/music/store/playlists.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/search.cjs +109 -0
- package/dist/martyrs/src/modules/music/store/search.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/search.js +109 -0
- package/dist/martyrs/src/modules/music/store/search.js.map +1 -0
- package/dist/martyrs/src/modules/music/store/tracks.cjs +184 -0
- package/dist/martyrs/src/modules/music/store/tracks.cjs.map +1 -0
- package/dist/martyrs/src/modules/music/store/tracks.js +184 -0
- package/dist/martyrs/src/modules/music/store/tracks.js.map +1 -0
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs +1 -1
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +3 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +3 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +2 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue.js +5 -5
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +3 -3
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js +16 -16
- 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 +3 -3
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +16 -16
- 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 +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- 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 +3 -3
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +17 -17
- 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 +3 -3
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +4 -4
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +8 -8
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +2 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/router/organizations.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/router/organizations.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +2 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +2 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +2 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +2 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +2 -2
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductImages.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductImages.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.js +8 -8
- package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.js +12 -12
- 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 +3 -3
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +13 -13
- package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.cjs +3 -3
- package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.js +11 -11
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +2 -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 +2 -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 +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +18 -18
- package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.cjs +3 -3
- package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.js +7 -7
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +3 -3
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +13 -13
- package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditRecommended.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditRecommended.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +3 -3
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +17 -17
- package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductsRecommended.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductsRecommended.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +5 -5
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +2 -2
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -0
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -0
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -0
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -0
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js.map +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 +3 -3
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +14 -14
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +3 -3
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +9 -9
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +2 -2
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +2 -2
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +3 -3
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +3 -3
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +38 -36
- package/dist/music.server.cjs +2021 -0
- package/dist/music.server.js +2021 -0
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/orders.server.cjs +1 -1
- package/dist/orders.server.js +1 -1
- package/dist/organizations.server.cjs +1 -1
- package/dist/organizations.server.js +1 -1
- package/dist/products.server.cjs +3 -1093
- package/dist/products.server.js +2 -1092
- package/dist/rents.server.cjs +1 -1
- package/dist/rents.server.js +1 -1
- package/dist/socials.schema-BOZV82Mp.js +25 -0
- package/dist/socials.schema-CtpSF9dE.cjs +24 -0
- package/dist/style.css +230 -46
- package/dist/wallet.server.cjs +1 -1
- package/dist/wallet.server.js +1 -1
- package/package.json +1 -1
- package/src/.martyrs/filemap.json +2 -2
- package/src/components/Feed/Feed.vue +1 -1
- package/src/components/Field/Field.vue +13 -8
- package/src/components/FieldBig/FieldBig.vue +3 -5
- package/src/components/FieldPhone/FieldPhone.vue +1 -1
- package/src/components/Media/Media.vue +1 -1
- package/src/components/Select/Select.vue +1 -1
- package/src/components/Status/Snack.vue +83 -0
- package/src/components/index.js +2 -0
- package/src/main.js +6 -0
- package/src/modules/auth/controllers/middlewares/authJwt.js +59 -6
- package/src/modules/events/components/pages/EditEvent.vue +1 -1
- package/src/modules/globals/views/classes/globals.store.js +31 -66
- package/src/modules/globals/views/components/blocks/PopupDateSelector.vue +1 -1
- package/src/modules/globals/views/components/partials/FooterAlt.vue +363 -0
- package/src/modules/globals/views/store/globals.js +42 -0
- package/src/modules/globals/views/utils/axios-instance.js +15 -1
- package/src/modules/globals/views/utils/query-serializer.js +182 -0
- package/src/modules/icons/components/IconSearchPopup.vue +254 -0
- package/src/modules/icons/entities/IconAddress.vue +17 -0
- package/src/modules/icons/entities/IconDate.vue +3 -3
- package/src/modules/icons/entities/IconEmail.vue +14 -0
- package/src/modules/icons/entities/IconMusic.vue +3 -3
- package/src/modules/icons/entities/IconPhone.vue +14 -0
- package/src/modules/icons/icons.client.js +85 -31
- package/src/modules/icons/icons.server.js +292 -0
- package/src/modules/icons/navigation/IconCross.vue +4 -16
- package/src/modules/icons/navigation/IconPause.vue +9 -24
- package/src/modules/icons/navigation/IconRefresh.vue +9 -24
- package/src/modules/icons/pages/IconsPage.vue +78 -2
- package/src/modules/icons/routes/icons.routes.js +81 -0
- package/src/modules/icons/socials/dribbble.vue +11 -2
- package/src/modules/icons/socials/facebook.vue +11 -2
- package/src/modules/icons/socials/instagram.vue +11 -4
- package/src/modules/icons/socials/line.vue +11 -2
- package/src/modules/icons/socials/linkedin.vue +11 -2
- package/src/modules/icons/socials/reddit.vue +10 -1
- package/src/modules/icons/socials/telegram.vue +11 -2
- package/src/modules/icons/socials/twitter.vue +11 -2
- package/src/modules/icons/socials/vk.vue +11 -2
- package/src/modules/icons/socials/whatsapp.vue +12 -0
- package/src/modules/icons/socials/youtube.vue +11 -2
- package/src/modules/music/.claude/settings.local.json +8 -0
- package/src/modules/music/CLAUDE.md +312 -0
- package/src/modules/music/components/SidebarMusic.vue +8 -8
- package/src/modules/music/components/cards/AlbumCard.vue +2 -2
- package/src/modules/music/components/cards/ArtistCard.vue +2 -2
- package/src/modules/music/components/cards/PlaylistCard.vue +2 -2
- package/src/modules/music/components/cards/TrackCard.vue +1 -1
- package/src/modules/music/components/cards/TrackListCard.vue +135 -0
- package/src/modules/music/components/forms/AlbumForm.vue +463 -0
- package/src/modules/music/components/{pages → forms}/ArtistForm.vue +127 -96
- package/src/modules/music/components/forms/PlaylistForm.vue +10 -10
- package/src/modules/music/components/forms/SearchForm.vue +1 -1
- package/src/modules/music/components/forms/TrackForm.vue +577 -0
- package/src/modules/music/components/layouts/MusicLayout.vue +35 -41
- package/src/modules/music/components/pages/{AlbumDetail.vue → Album.vue} +42 -20
- package/src/modules/music/components/pages/AlbumCreate.vue +7 -0
- package/src/modules/music/components/pages/AlbumEdit.vue +14 -0
- package/src/modules/music/components/pages/{ArtistDetail.vue → Artist.vue} +9 -9
- package/src/modules/music/components/pages/ArtistCreate.vue +7 -0
- package/src/modules/music/components/pages/ArtistEdit.vue +14 -0
- package/src/modules/music/components/pages/MusicHome.vue +86 -67
- package/src/modules/music/components/pages/MusicLibrary.vue +136 -105
- package/src/modules/music/components/pages/{PlaylistDetail.vue → Playlist.vue} +56 -34
- package/src/modules/music/components/pages/PlaylistCreate.vue +7 -0
- package/src/modules/music/components/pages/PlaylistEdit.vue +14 -0
- package/src/modules/music/components/pages/SearchResults.vue +49 -27
- package/src/modules/music/components/pages/{TrackDetail.vue → Track.vue} +36 -14
- package/src/modules/music/components/pages/TrackCreate.vue +23 -0
- package/src/modules/music/components/pages/TrackEdit.vue +14 -0
- package/src/modules/music/components/player/MusicPlayer.vue +2 -2
- package/src/modules/music/middlewares/albums.verifier.js +234 -0
- package/src/modules/music/middlewares/artists.verifier.js +213 -0
- package/src/modules/music/middlewares/genres.verifier.js +148 -0
- package/src/modules/music/middlewares/playlists.verifier.js +219 -0
- package/src/modules/music/middlewares/tracks.verifier.js +263 -0
- package/src/modules/music/music.client.js +31 -33
- package/src/modules/music/music.server.js +33 -26
- package/src/modules/music/router/albums.js +31 -0
- package/src/modules/music/router/artists.js +31 -0
- package/src/modules/music/router/music.js +14 -65
- package/src/modules/music/router/playlists.js +31 -0
- package/src/modules/music/router/tracks.js +31 -0
- package/src/modules/music/routes/albums.routes.js +126 -0
- package/src/modules/music/routes/artists.routes.js +171 -0
- package/src/modules/music/routes/genres.routes.js +118 -0
- package/src/modules/music/routes/playlists.routes.js +239 -0
- package/src/modules/music/routes/tracks.routes.js +149 -0
- package/src/modules/music/store/artists.js +17 -7
- package/src/modules/music/store/genres.js +150 -0
- package/src/modules/music/store/playlists.js +19 -6
- package/src/modules/music/store/tracks.js +9 -2
- package/src/modules/products/components/pages/Product.vue +1 -1
- package/dist/Media-ByPHBvAU.cjs +0 -1
- package/dist/main-137vO86w.cjs +0 -11
- package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +0 -1
- package/dist/martyrs/src/components/DatePicker/Calendar.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/DatePicker/Calendar.vue.js.map +0 -1
- package/dist/martyrs/src/components/Field/Field.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/Field/Field.vue.js.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/Popup/Popup.vue2.cjs.map +0 -1
- package/src/modules/music/components/forms/UploadForm.vue +0 -313
- package/src/modules/music/components/lists/AlbumList.vue +0 -25
- package/src/modules/music/components/lists/ArtistList.vue +0 -280
- package/src/modules/music/components/lists/PlaylistList.vue +0 -25
- package/src/modules/music/components/lists/TrackList.vue +0 -175
- package/src/modules/music/components/pages/ArtistManager.vue +0 -277
- package/src/modules/music/components/pages/MusicUpload.vue +0 -44
- package/src/modules/music/controllers/album.controller.js +0 -82
- package/src/modules/music/controllers/artist.controller.js +0 -99
- package/src/modules/music/controllers/genre.controller.js +0 -63
- package/src/modules/music/controllers/music.controller.js +0 -145
- package/src/modules/music/controllers/playlist.controller.js +0 -146
- package/src/modules/music/routes/album.routes.js +0 -28
- package/src/modules/music/routes/artist.routes.js +0 -30
- package/src/modules/music/routes/genre.routes.js +0 -28
- package/src/modules/music/routes/music.routes.js +0 -106
- package/src/modules/music/routes/playlist.routes.js +0 -47
- /package/src/components/{DatePicker → Calendar}/Calendar.vue +0 -0
|
@@ -0,0 +1,2021 @@
|
|
|
1
|
+
import { g as globalsabac } from "./globals.abac-DBV_kaOq.js";
|
|
2
|
+
import { L as Logger, C as Cache } from "./globals.logger-Bf6rRU7j.js";
|
|
3
|
+
import { W as WebSocketManager } from "./globals.websocket-DzvdIBf6.js";
|
|
4
|
+
import { C as CRUD } from "./crud-DJvpe0aZ.js";
|
|
5
|
+
import { A as ABAC } from "./abac-Cf_9lCSh.js";
|
|
6
|
+
import { V as Verifier, a as Validator } from "./globals.verifier-CWFz5Gh2.js";
|
|
7
|
+
import fs$1 from "fs";
|
|
8
|
+
import path$1 from "path";
|
|
9
|
+
import { a as applyCommonSchema } from "./common.schema-Bw1O5_2Q.js";
|
|
10
|
+
import { a as applyEngagementSchema } from "./engagement.schema-Dh1adRsn.js";
|
|
11
|
+
import { a as applyMetadataSchema, c as createFriendlyURL } from "./metadata.schema-CWmcDJN7.js";
|
|
12
|
+
import { a as applyOwnershipSchema } from "./ownership.schema-CCZX5vfw.js";
|
|
13
|
+
import { a as applySocialsSchema } from "./socials.schema-BOZV82Mp.js";
|
|
14
|
+
function tracksVerifierFactory(db) {
|
|
15
|
+
const createVerifier = new Verifier({
|
|
16
|
+
title: {
|
|
17
|
+
rule: "required",
|
|
18
|
+
validator: Validator.schema().string().required("Track title is required").min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
19
|
+
},
|
|
20
|
+
artist: {
|
|
21
|
+
rule: "required",
|
|
22
|
+
validator: Validator.schema().string().required("Artist is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
23
|
+
},
|
|
24
|
+
album: {
|
|
25
|
+
rule: "optional",
|
|
26
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
27
|
+
},
|
|
28
|
+
fileUrl: {
|
|
29
|
+
rule: "required",
|
|
30
|
+
validator: Validator.schema().string().required("File URL is required").pattern(/^https?:\/\/.+/, "Invalid file URL format")
|
|
31
|
+
},
|
|
32
|
+
coverUrl: {
|
|
33
|
+
rule: "optional",
|
|
34
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover URL format")
|
|
35
|
+
},
|
|
36
|
+
duration: {
|
|
37
|
+
rule: "optional",
|
|
38
|
+
default: 0,
|
|
39
|
+
validator: Validator.schema().number().min(0, "Duration cannot be negative").max(3600, "Duration cannot exceed 1 hour")
|
|
40
|
+
},
|
|
41
|
+
genre: {
|
|
42
|
+
rule: "optional",
|
|
43
|
+
validator: Validator.schema().array().items(
|
|
44
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
releaseDate: {
|
|
48
|
+
rule: "optional",
|
|
49
|
+
validator: Validator.schema().date()
|
|
50
|
+
},
|
|
51
|
+
isExplicit: {
|
|
52
|
+
rule: "optional",
|
|
53
|
+
default: false,
|
|
54
|
+
validator: Validator.schema().boolean()
|
|
55
|
+
},
|
|
56
|
+
lyrics: {
|
|
57
|
+
rule: "optional",
|
|
58
|
+
validator: Validator.schema().string().max(1e4, "Lyrics too long")
|
|
59
|
+
},
|
|
60
|
+
isPublic: {
|
|
61
|
+
rule: "optional",
|
|
62
|
+
default: true,
|
|
63
|
+
validator: Validator.schema().boolean()
|
|
64
|
+
},
|
|
65
|
+
owner: {
|
|
66
|
+
rule: "required",
|
|
67
|
+
validator: Validator.schema().object({
|
|
68
|
+
type: Validator.schema().string().oneOf(["user", "organization"]),
|
|
69
|
+
target: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const updateVerifier = new Verifier({
|
|
74
|
+
_id: {
|
|
75
|
+
rule: "required",
|
|
76
|
+
validator: Validator.schema().string().required("Track ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid track ID format")
|
|
77
|
+
},
|
|
78
|
+
title: {
|
|
79
|
+
rule: "optional",
|
|
80
|
+
validator: Validator.schema().string().min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
81
|
+
},
|
|
82
|
+
artist: {
|
|
83
|
+
rule: "optional",
|
|
84
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
85
|
+
},
|
|
86
|
+
album: {
|
|
87
|
+
rule: "optional",
|
|
88
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
89
|
+
},
|
|
90
|
+
fileUrl: {
|
|
91
|
+
rule: "optional",
|
|
92
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid file URL format")
|
|
93
|
+
},
|
|
94
|
+
coverUrl: {
|
|
95
|
+
rule: "optional",
|
|
96
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover URL format")
|
|
97
|
+
},
|
|
98
|
+
duration: {
|
|
99
|
+
rule: "optional",
|
|
100
|
+
validator: Validator.schema().number().min(0, "Duration cannot be negative").max(3600, "Duration cannot exceed 1 hour")
|
|
101
|
+
},
|
|
102
|
+
genre: {
|
|
103
|
+
rule: "optional",
|
|
104
|
+
validator: Validator.schema().array().items(
|
|
105
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
106
|
+
)
|
|
107
|
+
},
|
|
108
|
+
releaseDate: {
|
|
109
|
+
rule: "optional",
|
|
110
|
+
validator: Validator.schema().date()
|
|
111
|
+
},
|
|
112
|
+
isExplicit: {
|
|
113
|
+
rule: "optional",
|
|
114
|
+
validator: Validator.schema().boolean()
|
|
115
|
+
},
|
|
116
|
+
lyrics: {
|
|
117
|
+
rule: "optional",
|
|
118
|
+
validator: Validator.schema().string().max(1e4, "Lyrics too long")
|
|
119
|
+
},
|
|
120
|
+
isPublic: {
|
|
121
|
+
rule: "optional",
|
|
122
|
+
validator: Validator.schema().boolean()
|
|
123
|
+
},
|
|
124
|
+
status: {
|
|
125
|
+
rule: "optional",
|
|
126
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"], "Invalid status")
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const readVerifier = new Verifier({
|
|
130
|
+
_id: {
|
|
131
|
+
rule: "optional",
|
|
132
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid track ID format")
|
|
133
|
+
},
|
|
134
|
+
artist: {
|
|
135
|
+
rule: "optional",
|
|
136
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
137
|
+
},
|
|
138
|
+
album: {
|
|
139
|
+
rule: "optional",
|
|
140
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
141
|
+
},
|
|
142
|
+
genre: {
|
|
143
|
+
rule: "optional",
|
|
144
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
145
|
+
},
|
|
146
|
+
isPublic: {
|
|
147
|
+
rule: "optional",
|
|
148
|
+
validator: Validator.schema().boolean()
|
|
149
|
+
},
|
|
150
|
+
status: {
|
|
151
|
+
rule: "optional",
|
|
152
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"])
|
|
153
|
+
},
|
|
154
|
+
skip: {
|
|
155
|
+
rule: "optional",
|
|
156
|
+
default: 0,
|
|
157
|
+
validator: Validator.schema().integer().min(0)
|
|
158
|
+
},
|
|
159
|
+
limit: {
|
|
160
|
+
rule: "optional",
|
|
161
|
+
default: 20,
|
|
162
|
+
validator: Validator.schema().integer().min(1).max(100)
|
|
163
|
+
},
|
|
164
|
+
sortParam: {
|
|
165
|
+
rule: "optional",
|
|
166
|
+
validator: Validator.schema().string().oneOf(["title", "playCount", "releaseDate", "createdAt", "updatedAt"])
|
|
167
|
+
},
|
|
168
|
+
sortOrder: {
|
|
169
|
+
rule: "optional",
|
|
170
|
+
default: "desc",
|
|
171
|
+
validator: Validator.schema().string().oneOf(["asc", "desc"])
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const deleteVerifier = new Verifier({
|
|
175
|
+
_id: {
|
|
176
|
+
rule: "required",
|
|
177
|
+
validator: Validator.schema().string().required("Track ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid track ID format")
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
createVerifier,
|
|
182
|
+
readVerifier,
|
|
183
|
+
updateVerifier,
|
|
184
|
+
deleteVerifier
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const { getInstance: getInstance$4 } = ABAC;
|
|
188
|
+
function setupTracksRoutes(app, db) {
|
|
189
|
+
const abac = getInstance$4(db);
|
|
190
|
+
const verifier = tracksVerifierFactory();
|
|
191
|
+
const tracksCRUD = new CRUD({
|
|
192
|
+
app,
|
|
193
|
+
db,
|
|
194
|
+
model: db.track,
|
|
195
|
+
modelName: "track",
|
|
196
|
+
basePath: "/api/tracks",
|
|
197
|
+
auth: true,
|
|
198
|
+
verifiers: {
|
|
199
|
+
create: verifier.createVerifier,
|
|
200
|
+
read: verifier.readVerifier,
|
|
201
|
+
update: verifier.updateVerifier,
|
|
202
|
+
delete: verifier.deleteVerifier
|
|
203
|
+
},
|
|
204
|
+
abac,
|
|
205
|
+
cache: {
|
|
206
|
+
enabled: true,
|
|
207
|
+
ttl: 300,
|
|
208
|
+
tags: ["tracks", "music"]
|
|
209
|
+
},
|
|
210
|
+
events: {
|
|
211
|
+
enabled: true,
|
|
212
|
+
logReads: false
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
tracksCRUD.addAction("get-by-url", {
|
|
216
|
+
method: "get",
|
|
217
|
+
path: "/url/:url",
|
|
218
|
+
auth: false,
|
|
219
|
+
handler: async (req, res) => {
|
|
220
|
+
try {
|
|
221
|
+
const track = await db.track.findOne({ url: req.params.url });
|
|
222
|
+
if (!track) {
|
|
223
|
+
return res.status(404).json({ error: "Track not found" });
|
|
224
|
+
}
|
|
225
|
+
const accessResult = await abac.checkAccess({
|
|
226
|
+
user: req.userId,
|
|
227
|
+
resource: "tracks",
|
|
228
|
+
action: "read",
|
|
229
|
+
currentResource: track
|
|
230
|
+
});
|
|
231
|
+
if (!accessResult.allowed && !track.isPublic) {
|
|
232
|
+
return res.status(403).json({
|
|
233
|
+
errorCode: accessResult.reason,
|
|
234
|
+
message: "Access Denied"
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
res.json(track);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.error(error);
|
|
240
|
+
res.status(500).json({ error: error.message });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
tracksCRUD.addAction("recent", {
|
|
245
|
+
method: "get",
|
|
246
|
+
path: "/recent",
|
|
247
|
+
auth: false,
|
|
248
|
+
handler: async (req, res) => {
|
|
249
|
+
try {
|
|
250
|
+
const limit = parseInt(req.query.limit) || 10;
|
|
251
|
+
const recentTracks = await db.track.find({
|
|
252
|
+
status: "published",
|
|
253
|
+
isPublic: true
|
|
254
|
+
}).sort({ createdAt: -1 }).limit(limit);
|
|
255
|
+
res.json(recentTracks);
|
|
256
|
+
} catch (error) {
|
|
257
|
+
console.error(error);
|
|
258
|
+
res.status(500).json({ error: error.message });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
tracksCRUD.addAction("popular", {
|
|
263
|
+
method: "get",
|
|
264
|
+
path: "/popular",
|
|
265
|
+
auth: false,
|
|
266
|
+
handler: async (req, res) => {
|
|
267
|
+
try {
|
|
268
|
+
const limit = parseInt(req.query.limit) || 10;
|
|
269
|
+
const popularTracks = await db.track.find({
|
|
270
|
+
status: "published",
|
|
271
|
+
isPublic: true
|
|
272
|
+
}).sort({ playCount: -1 }).limit(limit);
|
|
273
|
+
res.json(popularTracks);
|
|
274
|
+
} catch (error) {
|
|
275
|
+
console.error(error);
|
|
276
|
+
res.status(500).json({ error: error.message });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
tracksCRUD.addAction("by-genre", {
|
|
281
|
+
method: "get",
|
|
282
|
+
path: "/genre/:genreId",
|
|
283
|
+
auth: false,
|
|
284
|
+
handler: async (req, res) => {
|
|
285
|
+
try {
|
|
286
|
+
const tracks = await db.track.find({
|
|
287
|
+
genre: req.params.genreId,
|
|
288
|
+
status: "published",
|
|
289
|
+
isPublic: true
|
|
290
|
+
}).sort({ releaseDate: -1 });
|
|
291
|
+
res.json(tracks);
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error(error);
|
|
294
|
+
res.status(500).json({ error: error.message });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return tracksCRUD;
|
|
299
|
+
}
|
|
300
|
+
function artistsVerifierFactory(db) {
|
|
301
|
+
const createVerifier = new Verifier({
|
|
302
|
+
name: {
|
|
303
|
+
rule: "required",
|
|
304
|
+
validator: Validator.schema().string().required("Artist name is required").min(1, "Name cannot be empty").max(100, "Name must not exceed 100 characters")
|
|
305
|
+
},
|
|
306
|
+
bio: {
|
|
307
|
+
rule: "optional",
|
|
308
|
+
validator: Validator.schema().string().max(2e3, "Bio must not exceed 2000 characters")
|
|
309
|
+
},
|
|
310
|
+
photoUrl: {
|
|
311
|
+
rule: "optional",
|
|
312
|
+
validator: Validator.schema().string().pattern(/^\/(?!\/)/, 'Only relative URLs starting with "/" are allowed')
|
|
313
|
+
},
|
|
314
|
+
coverUrl: {
|
|
315
|
+
rule: "optional",
|
|
316
|
+
validator: Validator.schema().string().pattern(/^\/(?!\/)/, 'Only relative URLs starting with "/" are allowed')
|
|
317
|
+
},
|
|
318
|
+
genre: {
|
|
319
|
+
rule: "optional",
|
|
320
|
+
validator: Validator.schema().array().items(
|
|
321
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
322
|
+
)
|
|
323
|
+
},
|
|
324
|
+
website: {
|
|
325
|
+
rule: "optional",
|
|
326
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid website URL format")
|
|
327
|
+
},
|
|
328
|
+
location: {
|
|
329
|
+
rule: "optional",
|
|
330
|
+
validator: Validator.schema().string().max(100, "Location must not exceed 100 characters")
|
|
331
|
+
},
|
|
332
|
+
owner: {
|
|
333
|
+
rule: "required",
|
|
334
|
+
validator: Validator.schema().object({
|
|
335
|
+
type: Validator.schema().string().oneOf(["user", "organization"]),
|
|
336
|
+
target: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
|
|
337
|
+
})
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
const updateVerifier = new Verifier({
|
|
341
|
+
_id: {
|
|
342
|
+
rule: "required",
|
|
343
|
+
validator: Validator.schema().string().required("Artist ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
344
|
+
},
|
|
345
|
+
name: {
|
|
346
|
+
rule: "optional",
|
|
347
|
+
validator: Validator.schema().string().min(1, "Name cannot be empty").max(100, "Name must not exceed 100 characters")
|
|
348
|
+
},
|
|
349
|
+
bio: {
|
|
350
|
+
rule: "optional",
|
|
351
|
+
validator: Validator.schema().string().max(2e3, "Bio must not exceed 2000 characters")
|
|
352
|
+
},
|
|
353
|
+
photoUrl: {
|
|
354
|
+
rule: "optional",
|
|
355
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid photo URL format")
|
|
356
|
+
},
|
|
357
|
+
coverUrl: {
|
|
358
|
+
rule: "optional",
|
|
359
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover URL format")
|
|
360
|
+
},
|
|
361
|
+
genre: {
|
|
362
|
+
rule: "optional",
|
|
363
|
+
validator: Validator.schema().array().items(
|
|
364
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
365
|
+
)
|
|
366
|
+
},
|
|
367
|
+
website: {
|
|
368
|
+
rule: "optional",
|
|
369
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid website URL format")
|
|
370
|
+
},
|
|
371
|
+
location: {
|
|
372
|
+
rule: "optional",
|
|
373
|
+
validator: Validator.schema().string().max(100, "Location must not exceed 100 characters")
|
|
374
|
+
},
|
|
375
|
+
isVerified: {
|
|
376
|
+
rule: "optional",
|
|
377
|
+
validator: Validator.schema().boolean()
|
|
378
|
+
},
|
|
379
|
+
status: {
|
|
380
|
+
rule: "optional",
|
|
381
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"], "Invalid status")
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
const readVerifier = new Verifier({
|
|
385
|
+
_id: {
|
|
386
|
+
rule: "optional",
|
|
387
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
388
|
+
},
|
|
389
|
+
genre: {
|
|
390
|
+
rule: "optional",
|
|
391
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
392
|
+
},
|
|
393
|
+
isVerified: {
|
|
394
|
+
rule: "optional",
|
|
395
|
+
validator: Validator.schema().boolean()
|
|
396
|
+
},
|
|
397
|
+
status: {
|
|
398
|
+
rule: "optional",
|
|
399
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"])
|
|
400
|
+
},
|
|
401
|
+
location: {
|
|
402
|
+
rule: "optional",
|
|
403
|
+
validator: Validator.schema().string()
|
|
404
|
+
},
|
|
405
|
+
skip: {
|
|
406
|
+
rule: "optional",
|
|
407
|
+
default: 0,
|
|
408
|
+
validator: Validator.schema().integer().min(0)
|
|
409
|
+
},
|
|
410
|
+
limit: {
|
|
411
|
+
rule: "optional",
|
|
412
|
+
default: 20,
|
|
413
|
+
validator: Validator.schema().integer().min(1).max(100)
|
|
414
|
+
},
|
|
415
|
+
sortParam: {
|
|
416
|
+
rule: "optional",
|
|
417
|
+
validator: Validator.schema().string().oneOf(["name", "popularity", "createdAt", "updatedAt"])
|
|
418
|
+
},
|
|
419
|
+
sortOrder: {
|
|
420
|
+
rule: "optional",
|
|
421
|
+
default: "desc",
|
|
422
|
+
validator: Validator.schema().string().oneOf(["asc", "desc"])
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
const deleteVerifier = new Verifier({
|
|
426
|
+
_id: {
|
|
427
|
+
rule: "required",
|
|
428
|
+
validator: Validator.schema().string().required("Artist ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
return {
|
|
432
|
+
createVerifier,
|
|
433
|
+
readVerifier,
|
|
434
|
+
updateVerifier,
|
|
435
|
+
deleteVerifier
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
const { getInstance: getInstance$3 } = ABAC;
|
|
439
|
+
function setupArtistsRoutes(app, db) {
|
|
440
|
+
const abac = getInstance$3(db);
|
|
441
|
+
const verifier = artistsVerifierFactory();
|
|
442
|
+
const artistsCRUD = new CRUD({
|
|
443
|
+
app,
|
|
444
|
+
db,
|
|
445
|
+
model: db.artist,
|
|
446
|
+
modelName: "artist",
|
|
447
|
+
basePath: "/api/artists",
|
|
448
|
+
auth: true,
|
|
449
|
+
verifiers: {
|
|
450
|
+
create: verifier.createVerifier,
|
|
451
|
+
read: verifier.readVerifier,
|
|
452
|
+
update: verifier.updateVerifier,
|
|
453
|
+
delete: verifier.deleteVerifier
|
|
454
|
+
},
|
|
455
|
+
abac,
|
|
456
|
+
cache: {
|
|
457
|
+
enabled: true,
|
|
458
|
+
ttl: 300,
|
|
459
|
+
tags: ["artists", "music"]
|
|
460
|
+
},
|
|
461
|
+
events: {
|
|
462
|
+
enabled: true,
|
|
463
|
+
logReads: false
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
artistsCRUD.addAction("get-by-url", {
|
|
467
|
+
method: "get",
|
|
468
|
+
path: "/url/:url",
|
|
469
|
+
auth: false,
|
|
470
|
+
handler: async (req, res) => {
|
|
471
|
+
try {
|
|
472
|
+
const artist = await db.artist.findOne({ url: req.params.url });
|
|
473
|
+
if (!artist) {
|
|
474
|
+
return res.status(404).json({ error: "Artist not found" });
|
|
475
|
+
}
|
|
476
|
+
res.json(artist);
|
|
477
|
+
} catch (error) {
|
|
478
|
+
console.error(error);
|
|
479
|
+
res.status(500).json({ error: error.message });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
artistsCRUD.addAction("discography", {
|
|
484
|
+
method: "get",
|
|
485
|
+
path: "/:artistId/discography",
|
|
486
|
+
auth: false,
|
|
487
|
+
handler: async (req, res) => {
|
|
488
|
+
try {
|
|
489
|
+
const { artistId } = req.params;
|
|
490
|
+
const albums = await db.album.find({ artists: artistId }).populate("artists", "name").sort({ releaseDate: -1 });
|
|
491
|
+
const tracks = await db.track.find({
|
|
492
|
+
artist: artistId,
|
|
493
|
+
status: "published",
|
|
494
|
+
isPublic: true
|
|
495
|
+
}).populate("album", "title").sort({ releaseDate: -1 });
|
|
496
|
+
res.json({
|
|
497
|
+
albums,
|
|
498
|
+
tracks,
|
|
499
|
+
artist: artistId
|
|
500
|
+
});
|
|
501
|
+
} catch (error) {
|
|
502
|
+
console.error(error);
|
|
503
|
+
res.status(500).json({ error: error.message });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
artistsCRUD.addAction("verify-artist", {
|
|
508
|
+
method: "put",
|
|
509
|
+
path: "/:artistId/verify",
|
|
510
|
+
auth: true,
|
|
511
|
+
abac: {
|
|
512
|
+
resource: "artists",
|
|
513
|
+
action: "verify",
|
|
514
|
+
strict: true
|
|
515
|
+
},
|
|
516
|
+
handler: async (req, res) => {
|
|
517
|
+
try {
|
|
518
|
+
const { artistId } = req.params;
|
|
519
|
+
const artist = await db.artist.findByIdAndUpdate(
|
|
520
|
+
artistId,
|
|
521
|
+
{ isVerified: true },
|
|
522
|
+
{ new: true }
|
|
523
|
+
);
|
|
524
|
+
if (!artist) {
|
|
525
|
+
return res.status(404).json({ error: "Artist not found" });
|
|
526
|
+
}
|
|
527
|
+
res.json({
|
|
528
|
+
message: "Artist verified successfully",
|
|
529
|
+
artist
|
|
530
|
+
});
|
|
531
|
+
} catch (error) {
|
|
532
|
+
console.error(error);
|
|
533
|
+
res.status(500).json({ error: error.message });
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
artistsCRUD.addAction("related-artists", {
|
|
538
|
+
method: "get",
|
|
539
|
+
path: "/:artistId/related",
|
|
540
|
+
auth: false,
|
|
541
|
+
handler: async (req, res) => {
|
|
542
|
+
try {
|
|
543
|
+
const { artistId } = req.params;
|
|
544
|
+
const limit = parseInt(req.query.limit) || 10;
|
|
545
|
+
const artist = await db.artist.findById(artistId);
|
|
546
|
+
if (!artist) {
|
|
547
|
+
return res.status(404).json({ error: "Artist not found" });
|
|
548
|
+
}
|
|
549
|
+
const relatedArtists = await db.artist.find({
|
|
550
|
+
_id: { $ne: artistId },
|
|
551
|
+
// исключаем самого артиста
|
|
552
|
+
genre: { $in: artist.genre },
|
|
553
|
+
// общие жанры
|
|
554
|
+
status: "published"
|
|
555
|
+
}).limit(limit).sort({ popularity: -1 });
|
|
556
|
+
res.json(relatedArtists);
|
|
557
|
+
} catch (error) {
|
|
558
|
+
console.error(error);
|
|
559
|
+
res.status(500).json({ error: error.message });
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
return artistsCRUD;
|
|
564
|
+
}
|
|
565
|
+
function albumsVerifierFactory(db) {
|
|
566
|
+
const createVerifier = new Verifier({
|
|
567
|
+
title: {
|
|
568
|
+
rule: "required",
|
|
569
|
+
validator: Validator.schema().string().required("Album title is required").min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
570
|
+
},
|
|
571
|
+
description: {
|
|
572
|
+
rule: "optional",
|
|
573
|
+
validator: Validator.schema().string().max(1e3, "Description must not exceed 1000 characters")
|
|
574
|
+
},
|
|
575
|
+
releaseDate: {
|
|
576
|
+
rule: "required",
|
|
577
|
+
validator: Validator.schema().date().required("Release date is required")
|
|
578
|
+
},
|
|
579
|
+
coverArt: {
|
|
580
|
+
rule: "optional",
|
|
581
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover art URL format")
|
|
582
|
+
},
|
|
583
|
+
artists: {
|
|
584
|
+
rule: "required",
|
|
585
|
+
validator: Validator.schema().array().items(
|
|
586
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
587
|
+
).min(1, "At least one artist is required")
|
|
588
|
+
},
|
|
589
|
+
type: {
|
|
590
|
+
rule: "optional",
|
|
591
|
+
default: "album",
|
|
592
|
+
validator: Validator.schema().string().oneOf(["album", "single", "EP", "compilation"], "Invalid album type")
|
|
593
|
+
},
|
|
594
|
+
genres: {
|
|
595
|
+
rule: "optional",
|
|
596
|
+
validator: Validator.schema().array().items(
|
|
597
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
598
|
+
)
|
|
599
|
+
},
|
|
600
|
+
totalTracks: {
|
|
601
|
+
rule: "optional",
|
|
602
|
+
default: 0,
|
|
603
|
+
validator: Validator.schema().integer().min(0, "Total tracks cannot be negative").max(100, "Too many tracks")
|
|
604
|
+
},
|
|
605
|
+
owner: {
|
|
606
|
+
rule: "required",
|
|
607
|
+
validator: Validator.schema().object({
|
|
608
|
+
type: Validator.schema().string().oneOf(["user", "organization"]),
|
|
609
|
+
target: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
|
|
610
|
+
})
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
const updateVerifier = new Verifier({
|
|
614
|
+
_id: {
|
|
615
|
+
rule: "required",
|
|
616
|
+
validator: Validator.schema().string().required("Album ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
617
|
+
},
|
|
618
|
+
title: {
|
|
619
|
+
rule: "optional",
|
|
620
|
+
validator: Validator.schema().string().min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
621
|
+
},
|
|
622
|
+
description: {
|
|
623
|
+
rule: "optional",
|
|
624
|
+
validator: Validator.schema().string().max(1e3, "Description must not exceed 1000 characters")
|
|
625
|
+
},
|
|
626
|
+
releaseDate: {
|
|
627
|
+
rule: "optional",
|
|
628
|
+
validator: Validator.schema().date()
|
|
629
|
+
},
|
|
630
|
+
coverArt: {
|
|
631
|
+
rule: "optional",
|
|
632
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover art URL format")
|
|
633
|
+
},
|
|
634
|
+
artists: {
|
|
635
|
+
rule: "optional",
|
|
636
|
+
validator: Validator.schema().array().items(
|
|
637
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
638
|
+
).min(1, "At least one artist is required")
|
|
639
|
+
},
|
|
640
|
+
type: {
|
|
641
|
+
rule: "optional",
|
|
642
|
+
validator: Validator.schema().string().oneOf(["album", "single", "EP", "compilation"], "Invalid album type")
|
|
643
|
+
},
|
|
644
|
+
genres: {
|
|
645
|
+
rule: "optional",
|
|
646
|
+
validator: Validator.schema().array().items(
|
|
647
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
648
|
+
)
|
|
649
|
+
},
|
|
650
|
+
totalTracks: {
|
|
651
|
+
rule: "optional",
|
|
652
|
+
validator: Validator.schema().integer().min(0, "Total tracks cannot be negative").max(100, "Too many tracks")
|
|
653
|
+
},
|
|
654
|
+
status: {
|
|
655
|
+
rule: "optional",
|
|
656
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"], "Invalid status")
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
const readVerifier = new Verifier({
|
|
660
|
+
_id: {
|
|
661
|
+
rule: "optional",
|
|
662
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
663
|
+
},
|
|
664
|
+
artists: {
|
|
665
|
+
rule: "optional",
|
|
666
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid artist ID format")
|
|
667
|
+
},
|
|
668
|
+
type: {
|
|
669
|
+
rule: "optional",
|
|
670
|
+
validator: Validator.schema().string().oneOf(["album", "single", "EP", "compilation"])
|
|
671
|
+
},
|
|
672
|
+
genres: {
|
|
673
|
+
rule: "optional",
|
|
674
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
675
|
+
},
|
|
676
|
+
status: {
|
|
677
|
+
rule: "optional",
|
|
678
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"])
|
|
679
|
+
},
|
|
680
|
+
skip: {
|
|
681
|
+
rule: "optional",
|
|
682
|
+
default: 0,
|
|
683
|
+
validator: Validator.schema().integer().min(0)
|
|
684
|
+
},
|
|
685
|
+
limit: {
|
|
686
|
+
rule: "optional",
|
|
687
|
+
default: 20,
|
|
688
|
+
validator: Validator.schema().integer().min(1).max(100)
|
|
689
|
+
},
|
|
690
|
+
sortParam: {
|
|
691
|
+
rule: "optional",
|
|
692
|
+
validator: Validator.schema().string().oneOf(["title", "releaseDate", "totalTracks", "createdAt", "updatedAt"])
|
|
693
|
+
},
|
|
694
|
+
sortOrder: {
|
|
695
|
+
rule: "optional",
|
|
696
|
+
default: "desc",
|
|
697
|
+
validator: Validator.schema().string().oneOf(["asc", "desc"])
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
const deleteVerifier = new Verifier({
|
|
701
|
+
_id: {
|
|
702
|
+
rule: "required",
|
|
703
|
+
validator: Validator.schema().string().required("Album ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid album ID format")
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
return {
|
|
707
|
+
createVerifier,
|
|
708
|
+
readVerifier,
|
|
709
|
+
updateVerifier,
|
|
710
|
+
deleteVerifier
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
const { getInstance: getInstance$2 } = ABAC;
|
|
714
|
+
function setupAlbumsRoutes(app, db) {
|
|
715
|
+
const abac = getInstance$2(db);
|
|
716
|
+
const verifier = albumsVerifierFactory();
|
|
717
|
+
const albumsCRUD = new CRUD({
|
|
718
|
+
app,
|
|
719
|
+
db,
|
|
720
|
+
model: db.album,
|
|
721
|
+
modelName: "album",
|
|
722
|
+
basePath: "/api/albums",
|
|
723
|
+
auth: true,
|
|
724
|
+
verifiers: {
|
|
725
|
+
create: verifier.createVerifier,
|
|
726
|
+
read: verifier.readVerifier,
|
|
727
|
+
update: verifier.updateVerifier,
|
|
728
|
+
delete: verifier.deleteVerifier
|
|
729
|
+
},
|
|
730
|
+
abac,
|
|
731
|
+
cache: {
|
|
732
|
+
enabled: true,
|
|
733
|
+
ttl: 300,
|
|
734
|
+
tags: ["albums", "music"]
|
|
735
|
+
},
|
|
736
|
+
events: {
|
|
737
|
+
enabled: true,
|
|
738
|
+
logReads: false
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
albumsCRUD.addAction("get-by-url", {
|
|
742
|
+
method: "get",
|
|
743
|
+
path: "/url/:url",
|
|
744
|
+
auth: false,
|
|
745
|
+
handler: async (req, res) => {
|
|
746
|
+
try {
|
|
747
|
+
const album = await db.album.findOne({ url: req.params.url }).populate("artists", "name url");
|
|
748
|
+
if (!album) {
|
|
749
|
+
return res.status(404).json({ error: "Album not found" });
|
|
750
|
+
}
|
|
751
|
+
res.json(album);
|
|
752
|
+
} catch (error) {
|
|
753
|
+
console.error(error);
|
|
754
|
+
res.status(500).json({ error: error.message });
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
albumsCRUD.addAction("album-tracks", {
|
|
759
|
+
method: "get",
|
|
760
|
+
path: "/:albumId/tracks",
|
|
761
|
+
auth: false,
|
|
762
|
+
handler: async (req, res) => {
|
|
763
|
+
try {
|
|
764
|
+
const { albumId } = req.params;
|
|
765
|
+
const tracks = await db.track.find({
|
|
766
|
+
album: albumId,
|
|
767
|
+
status: "published",
|
|
768
|
+
isPublic: true
|
|
769
|
+
}).populate("artist", "name url").populate("genre", "name").sort({ trackNumber: 1, createdAt: 1 });
|
|
770
|
+
res.json(tracks);
|
|
771
|
+
} catch (error) {
|
|
772
|
+
console.error(error);
|
|
773
|
+
res.status(500).json({ error: error.message });
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
albumsCRUD.addAction("featured", {
|
|
778
|
+
method: "get",
|
|
779
|
+
path: "/featured",
|
|
780
|
+
auth: false,
|
|
781
|
+
handler: async (req, res) => {
|
|
782
|
+
try {
|
|
783
|
+
const limit = parseInt(req.query.limit) || 10;
|
|
784
|
+
const featuredAlbums = await db.album.find({
|
|
785
|
+
status: "published",
|
|
786
|
+
releaseDate: {
|
|
787
|
+
$gte: new Date(Date.now() - 90 * 24 * 60 * 60 * 1e3)
|
|
788
|
+
// последние 90 дней
|
|
789
|
+
}
|
|
790
|
+
}).populate("artists", "name url").sort({ createdAt: -1 }).limit(limit);
|
|
791
|
+
res.json(featuredAlbums);
|
|
792
|
+
} catch (error) {
|
|
793
|
+
console.error(error);
|
|
794
|
+
res.status(500).json({ error: error.message });
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
return albumsCRUD;
|
|
799
|
+
}
|
|
800
|
+
function playlistsVerifierFactory(db) {
|
|
801
|
+
const createVerifier = new Verifier({
|
|
802
|
+
title: {
|
|
803
|
+
rule: "required",
|
|
804
|
+
validator: Validator.schema().string().required("Playlist title is required").min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
805
|
+
},
|
|
806
|
+
description: {
|
|
807
|
+
rule: "optional",
|
|
808
|
+
validator: Validator.schema().string().max(1e3, "Description must not exceed 1000 characters")
|
|
809
|
+
},
|
|
810
|
+
coverUrl: {
|
|
811
|
+
rule: "optional",
|
|
812
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover URL format")
|
|
813
|
+
},
|
|
814
|
+
tracks: {
|
|
815
|
+
rule: "optional",
|
|
816
|
+
validator: Validator.schema().array().items(
|
|
817
|
+
Validator.schema().object({
|
|
818
|
+
track: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid track ID format").required(),
|
|
819
|
+
addedAt: Validator.schema().date()
|
|
820
|
+
})
|
|
821
|
+
)
|
|
822
|
+
},
|
|
823
|
+
isPublic: {
|
|
824
|
+
rule: "optional",
|
|
825
|
+
default: true,
|
|
826
|
+
validator: Validator.schema().boolean()
|
|
827
|
+
},
|
|
828
|
+
isCollaborative: {
|
|
829
|
+
rule: "optional",
|
|
830
|
+
default: false,
|
|
831
|
+
validator: Validator.schema().boolean()
|
|
832
|
+
},
|
|
833
|
+
collaborators: {
|
|
834
|
+
rule: "optional",
|
|
835
|
+
validator: Validator.schema().array().items(
|
|
836
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid collaborator ID format")
|
|
837
|
+
)
|
|
838
|
+
},
|
|
839
|
+
owner: {
|
|
840
|
+
rule: "required",
|
|
841
|
+
validator: Validator.schema().object({
|
|
842
|
+
type: Validator.schema().string().oneOf(["user", "organization"]),
|
|
843
|
+
target: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
|
|
844
|
+
})
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
const updateVerifier = new Verifier({
|
|
848
|
+
_id: {
|
|
849
|
+
rule: "required",
|
|
850
|
+
validator: Validator.schema().string().required("Playlist ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid playlist ID format")
|
|
851
|
+
},
|
|
852
|
+
title: {
|
|
853
|
+
rule: "optional",
|
|
854
|
+
validator: Validator.schema().string().min(1, "Title cannot be empty").max(200, "Title must not exceed 200 characters")
|
|
855
|
+
},
|
|
856
|
+
description: {
|
|
857
|
+
rule: "optional",
|
|
858
|
+
validator: Validator.schema().string().max(1e3, "Description must not exceed 1000 characters")
|
|
859
|
+
},
|
|
860
|
+
coverUrl: {
|
|
861
|
+
rule: "optional",
|
|
862
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid cover URL format")
|
|
863
|
+
},
|
|
864
|
+
tracks: {
|
|
865
|
+
rule: "optional",
|
|
866
|
+
validator: Validator.schema().array().items(
|
|
867
|
+
Validator.schema().object({
|
|
868
|
+
track: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid track ID format").required(),
|
|
869
|
+
addedAt: Validator.schema().date()
|
|
870
|
+
})
|
|
871
|
+
)
|
|
872
|
+
},
|
|
873
|
+
isPublic: {
|
|
874
|
+
rule: "optional",
|
|
875
|
+
validator: Validator.schema().boolean()
|
|
876
|
+
},
|
|
877
|
+
isCollaborative: {
|
|
878
|
+
rule: "optional",
|
|
879
|
+
validator: Validator.schema().boolean()
|
|
880
|
+
},
|
|
881
|
+
collaborators: {
|
|
882
|
+
rule: "optional",
|
|
883
|
+
validator: Validator.schema().array().items(
|
|
884
|
+
Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid collaborator ID format")
|
|
885
|
+
)
|
|
886
|
+
},
|
|
887
|
+
status: {
|
|
888
|
+
rule: "optional",
|
|
889
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"], "Invalid status")
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
const readVerifier = new Verifier({
|
|
893
|
+
_id: {
|
|
894
|
+
rule: "optional",
|
|
895
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid playlist ID format")
|
|
896
|
+
},
|
|
897
|
+
owner: {
|
|
898
|
+
rule: "optional",
|
|
899
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid owner ID format")
|
|
900
|
+
},
|
|
901
|
+
isPublic: {
|
|
902
|
+
rule: "optional",
|
|
903
|
+
validator: Validator.schema().boolean()
|
|
904
|
+
},
|
|
905
|
+
isCollaborative: {
|
|
906
|
+
rule: "optional",
|
|
907
|
+
validator: Validator.schema().boolean()
|
|
908
|
+
},
|
|
909
|
+
status: {
|
|
910
|
+
rule: "optional",
|
|
911
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"])
|
|
912
|
+
},
|
|
913
|
+
skip: {
|
|
914
|
+
rule: "optional",
|
|
915
|
+
default: 0,
|
|
916
|
+
validator: Validator.schema().integer().min(0)
|
|
917
|
+
},
|
|
918
|
+
limit: {
|
|
919
|
+
rule: "optional",
|
|
920
|
+
default: 20,
|
|
921
|
+
validator: Validator.schema().integer().min(1).max(100)
|
|
922
|
+
},
|
|
923
|
+
sortParam: {
|
|
924
|
+
rule: "optional",
|
|
925
|
+
validator: Validator.schema().string().oneOf(["title", "followers", "createdAt", "updatedAt"])
|
|
926
|
+
},
|
|
927
|
+
sortOrder: {
|
|
928
|
+
rule: "optional",
|
|
929
|
+
default: "desc",
|
|
930
|
+
validator: Validator.schema().string().oneOf(["asc", "desc"])
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
const deleteVerifier = new Verifier({
|
|
934
|
+
_id: {
|
|
935
|
+
rule: "required",
|
|
936
|
+
validator: Validator.schema().string().required("Playlist ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid playlist ID format")
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
return {
|
|
940
|
+
createVerifier,
|
|
941
|
+
readVerifier,
|
|
942
|
+
updateVerifier,
|
|
943
|
+
deleteVerifier
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
const { getInstance: getInstance$1 } = ABAC;
|
|
947
|
+
function setupPlaylistsRoutes(app, db) {
|
|
948
|
+
const abac = getInstance$1(db);
|
|
949
|
+
const verifier = playlistsVerifierFactory();
|
|
950
|
+
const playlistsCRUD = new CRUD({
|
|
951
|
+
app,
|
|
952
|
+
db,
|
|
953
|
+
model: db.playlist,
|
|
954
|
+
modelName: "playlist",
|
|
955
|
+
basePath: "/api/playlists",
|
|
956
|
+
auth: true,
|
|
957
|
+
verifiers: {
|
|
958
|
+
create: verifier.createVerifier,
|
|
959
|
+
read: verifier.readVerifier,
|
|
960
|
+
update: verifier.updateVerifier,
|
|
961
|
+
delete: verifier.deleteVerifier
|
|
962
|
+
},
|
|
963
|
+
abac,
|
|
964
|
+
cache: {
|
|
965
|
+
enabled: true,
|
|
966
|
+
ttl: 300,
|
|
967
|
+
tags: ["playlists", "music"]
|
|
968
|
+
},
|
|
969
|
+
events: {
|
|
970
|
+
enabled: true,
|
|
971
|
+
logReads: false
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
playlistsCRUD.addAction("get-by-url", {
|
|
975
|
+
method: "get",
|
|
976
|
+
path: "/url/:url",
|
|
977
|
+
auth: false,
|
|
978
|
+
handler: async (req, res) => {
|
|
979
|
+
try {
|
|
980
|
+
const playlist = await db.playlist.findOne({ url: req.params.url }).populate({
|
|
981
|
+
path: "tracks.track",
|
|
982
|
+
select: "-lyrics"
|
|
983
|
+
});
|
|
984
|
+
if (!playlist) {
|
|
985
|
+
return res.status(404).json({ error: "Playlist not found" });
|
|
986
|
+
}
|
|
987
|
+
if (!playlist.isPublic) {
|
|
988
|
+
if (!req.userId) {
|
|
989
|
+
return res.status(403).json({ error: "Access denied to private playlist" });
|
|
990
|
+
}
|
|
991
|
+
const isOwner = playlist.owner.target.toString() === req.userId;
|
|
992
|
+
const isCollaborator = playlist.collaborators.some((collab) => collab.toString() === req.userId);
|
|
993
|
+
if (!isOwner && !isCollaborator) {
|
|
994
|
+
return res.status(403).json({ error: "Access denied to private playlist" });
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
res.json(playlist);
|
|
998
|
+
} catch (error) {
|
|
999
|
+
console.error(error);
|
|
1000
|
+
res.status(500).json({ error: error.message });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
playlistsCRUD.addAction("user-playlists", {
|
|
1005
|
+
method: "get",
|
|
1006
|
+
path: "/user/:userId?",
|
|
1007
|
+
auth: true,
|
|
1008
|
+
handler: async (req, res) => {
|
|
1009
|
+
try {
|
|
1010
|
+
const userId = req.params.userId || req.userId;
|
|
1011
|
+
const query = { "owner.target": userId };
|
|
1012
|
+
if (userId !== req.userId) {
|
|
1013
|
+
query.isPublic = true;
|
|
1014
|
+
}
|
|
1015
|
+
const playlists = await db.playlist.find(query).populate("tracks.track", "title artist").sort({ updatedAt: -1 });
|
|
1016
|
+
res.json(playlists);
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
console.error(error);
|
|
1019
|
+
res.status(500).json({ error: error.message });
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
playlistsCRUD.addAction("add-track", {
|
|
1024
|
+
method: "post",
|
|
1025
|
+
path: "/:playlistId/tracks/:trackId",
|
|
1026
|
+
auth: true,
|
|
1027
|
+
abac: {
|
|
1028
|
+
resource: "playlists",
|
|
1029
|
+
action: "update"
|
|
1030
|
+
},
|
|
1031
|
+
handler: async (req, res) => {
|
|
1032
|
+
try {
|
|
1033
|
+
const { playlistId, trackId } = req.params;
|
|
1034
|
+
const track = await db.track.findById(trackId);
|
|
1035
|
+
if (!track) {
|
|
1036
|
+
return res.status(404).json({ error: "Track not found" });
|
|
1037
|
+
}
|
|
1038
|
+
const playlist = await db.playlist.findById(playlistId);
|
|
1039
|
+
if (!playlist) {
|
|
1040
|
+
return res.status(404).json({ error: "Playlist not found" });
|
|
1041
|
+
}
|
|
1042
|
+
const trackExists = playlist.tracks.some((t) => t.track.toString() === trackId);
|
|
1043
|
+
if (trackExists) {
|
|
1044
|
+
return res.status(400).json({ error: "Track already in playlist" });
|
|
1045
|
+
}
|
|
1046
|
+
playlist.tracks.push({
|
|
1047
|
+
track: trackId,
|
|
1048
|
+
addedAt: /* @__PURE__ */ new Date()
|
|
1049
|
+
});
|
|
1050
|
+
await playlist.save();
|
|
1051
|
+
res.json({
|
|
1052
|
+
message: "Track added to playlist successfully",
|
|
1053
|
+
playlist
|
|
1054
|
+
});
|
|
1055
|
+
} catch (error) {
|
|
1056
|
+
console.error(error);
|
|
1057
|
+
res.status(500).json({ error: error.message });
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
playlistsCRUD.addAction("remove-track", {
|
|
1062
|
+
method: "delete",
|
|
1063
|
+
path: "/:playlistId/tracks/:trackId",
|
|
1064
|
+
auth: true,
|
|
1065
|
+
abac: {
|
|
1066
|
+
resource: "playlists",
|
|
1067
|
+
action: "update"
|
|
1068
|
+
},
|
|
1069
|
+
handler: async (req, res) => {
|
|
1070
|
+
try {
|
|
1071
|
+
const { playlistId, trackId } = req.params;
|
|
1072
|
+
const playlist = await db.playlist.findById(playlistId);
|
|
1073
|
+
if (!playlist) {
|
|
1074
|
+
return res.status(404).json({ error: "Playlist not found" });
|
|
1075
|
+
}
|
|
1076
|
+
playlist.tracks = playlist.tracks.filter(
|
|
1077
|
+
(t) => t.track.toString() !== trackId
|
|
1078
|
+
);
|
|
1079
|
+
await playlist.save();
|
|
1080
|
+
res.json({
|
|
1081
|
+
message: "Track removed from playlist successfully",
|
|
1082
|
+
playlist
|
|
1083
|
+
});
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
console.error(error);
|
|
1086
|
+
res.status(500).json({ error: error.message });
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
playlistsCRUD.addAction("add-collaborator", {
|
|
1091
|
+
method: "post",
|
|
1092
|
+
path: "/:playlistId/collaborators/:userId",
|
|
1093
|
+
auth: true,
|
|
1094
|
+
abac: {
|
|
1095
|
+
resource: "playlists",
|
|
1096
|
+
action: "update"
|
|
1097
|
+
},
|
|
1098
|
+
handler: async (req, res) => {
|
|
1099
|
+
try {
|
|
1100
|
+
const { playlistId, userId } = req.params;
|
|
1101
|
+
const playlist = await db.playlist.findById(playlistId);
|
|
1102
|
+
if (!playlist) {
|
|
1103
|
+
return res.status(404).json({ error: "Playlist not found" });
|
|
1104
|
+
}
|
|
1105
|
+
if (playlist.collaborators.includes(userId)) {
|
|
1106
|
+
return res.status(400).json({ error: "User is already a collaborator" });
|
|
1107
|
+
}
|
|
1108
|
+
playlist.collaborators.push(userId);
|
|
1109
|
+
playlist.isCollaborative = true;
|
|
1110
|
+
await playlist.save();
|
|
1111
|
+
res.json({
|
|
1112
|
+
message: "Collaborator added successfully",
|
|
1113
|
+
playlist
|
|
1114
|
+
});
|
|
1115
|
+
} catch (error) {
|
|
1116
|
+
console.error(error);
|
|
1117
|
+
res.status(500).json({ error: error.message });
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
return playlistsCRUD;
|
|
1122
|
+
}
|
|
1123
|
+
function genresVerifierFactory(db) {
|
|
1124
|
+
const createVerifier = new Verifier({
|
|
1125
|
+
name: {
|
|
1126
|
+
rule: "required",
|
|
1127
|
+
validator: Validator.schema().string().required("Genre name is required").min(1, "Name cannot be empty").max(50, "Name must not exceed 50 characters")
|
|
1128
|
+
},
|
|
1129
|
+
description: {
|
|
1130
|
+
rule: "optional",
|
|
1131
|
+
validator: Validator.schema().string().max(500, "Description must not exceed 500 characters")
|
|
1132
|
+
},
|
|
1133
|
+
iconUrl: {
|
|
1134
|
+
rule: "optional",
|
|
1135
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid icon URL format")
|
|
1136
|
+
},
|
|
1137
|
+
popularity: {
|
|
1138
|
+
rule: "optional",
|
|
1139
|
+
default: 0,
|
|
1140
|
+
validator: Validator.schema().number().min(0, "Popularity cannot be negative").max(100, "Popularity cannot exceed 100")
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
const updateVerifier = new Verifier({
|
|
1144
|
+
_id: {
|
|
1145
|
+
rule: "required",
|
|
1146
|
+
validator: Validator.schema().string().required("Genre ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
1147
|
+
},
|
|
1148
|
+
name: {
|
|
1149
|
+
rule: "optional",
|
|
1150
|
+
validator: Validator.schema().string().min(1, "Name cannot be empty").max(50, "Name must not exceed 50 characters")
|
|
1151
|
+
},
|
|
1152
|
+
description: {
|
|
1153
|
+
rule: "optional",
|
|
1154
|
+
validator: Validator.schema().string().max(500, "Description must not exceed 500 characters")
|
|
1155
|
+
},
|
|
1156
|
+
iconUrl: {
|
|
1157
|
+
rule: "optional",
|
|
1158
|
+
validator: Validator.schema().string().pattern(/^https?:\/\/.+/, "Invalid icon URL format")
|
|
1159
|
+
},
|
|
1160
|
+
popularity: {
|
|
1161
|
+
rule: "optional",
|
|
1162
|
+
validator: Validator.schema().number().min(0, "Popularity cannot be negative").max(100, "Popularity cannot exceed 100")
|
|
1163
|
+
},
|
|
1164
|
+
status: {
|
|
1165
|
+
rule: "optional",
|
|
1166
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"], "Invalid status")
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
const readVerifier = new Verifier({
|
|
1170
|
+
_id: {
|
|
1171
|
+
rule: "optional",
|
|
1172
|
+
validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
1173
|
+
},
|
|
1174
|
+
name: {
|
|
1175
|
+
rule: "optional",
|
|
1176
|
+
validator: Validator.schema().string()
|
|
1177
|
+
},
|
|
1178
|
+
status: {
|
|
1179
|
+
rule: "optional",
|
|
1180
|
+
validator: Validator.schema().string().oneOf(["draft", "published", "archived"])
|
|
1181
|
+
},
|
|
1182
|
+
skip: {
|
|
1183
|
+
rule: "optional",
|
|
1184
|
+
default: 0,
|
|
1185
|
+
validator: Validator.schema().integer().min(0)
|
|
1186
|
+
},
|
|
1187
|
+
limit: {
|
|
1188
|
+
rule: "optional",
|
|
1189
|
+
default: 20,
|
|
1190
|
+
validator: Validator.schema().integer().min(1).max(100)
|
|
1191
|
+
},
|
|
1192
|
+
sortParam: {
|
|
1193
|
+
rule: "optional",
|
|
1194
|
+
validator: Validator.schema().string().oneOf(["name", "popularity", "createdAt", "updatedAt"])
|
|
1195
|
+
},
|
|
1196
|
+
sortOrder: {
|
|
1197
|
+
rule: "optional",
|
|
1198
|
+
default: "desc",
|
|
1199
|
+
validator: Validator.schema().string().oneOf(["asc", "desc"])
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
const deleteVerifier = new Verifier({
|
|
1203
|
+
_id: {
|
|
1204
|
+
rule: "required",
|
|
1205
|
+
validator: Validator.schema().string().required("Genre ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid genre ID format")
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
return {
|
|
1209
|
+
createVerifier,
|
|
1210
|
+
readVerifier,
|
|
1211
|
+
updateVerifier,
|
|
1212
|
+
deleteVerifier
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
const { getInstance } = ABAC;
|
|
1216
|
+
function setupGenresRoutes(app, db) {
|
|
1217
|
+
const abac = getInstance(db);
|
|
1218
|
+
const verifier = genresVerifierFactory();
|
|
1219
|
+
const genresCRUD = new CRUD({
|
|
1220
|
+
app,
|
|
1221
|
+
db,
|
|
1222
|
+
model: db.genre,
|
|
1223
|
+
modelName: "genre",
|
|
1224
|
+
basePath: "/api/genres",
|
|
1225
|
+
auth: true,
|
|
1226
|
+
verifiers: {
|
|
1227
|
+
create: verifier.createVerifier,
|
|
1228
|
+
read: verifier.readVerifier,
|
|
1229
|
+
update: verifier.updateVerifier,
|
|
1230
|
+
delete: verifier.deleteVerifier
|
|
1231
|
+
},
|
|
1232
|
+
abac,
|
|
1233
|
+
cache: {
|
|
1234
|
+
enabled: true,
|
|
1235
|
+
ttl: 300,
|
|
1236
|
+
tags: ["genres", "music"]
|
|
1237
|
+
},
|
|
1238
|
+
events: {
|
|
1239
|
+
enabled: true,
|
|
1240
|
+
logReads: false
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
genresCRUD.addAction("get-by-url", {
|
|
1244
|
+
method: "get",
|
|
1245
|
+
path: "/url/:url",
|
|
1246
|
+
auth: false,
|
|
1247
|
+
handler: async (req, res) => {
|
|
1248
|
+
try {
|
|
1249
|
+
const genre = await db.genre.findOne({ url: req.params.url });
|
|
1250
|
+
if (!genre) {
|
|
1251
|
+
return res.status(404).json({ error: "Genre not found" });
|
|
1252
|
+
}
|
|
1253
|
+
res.json(genre);
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
console.error(error);
|
|
1256
|
+
res.status(500).json({ error: error.message });
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
genresCRUD.addAction("genre-tracks", {
|
|
1261
|
+
method: "get",
|
|
1262
|
+
path: "/:genreId/tracks",
|
|
1263
|
+
auth: false,
|
|
1264
|
+
handler: async (req, res) => {
|
|
1265
|
+
try {
|
|
1266
|
+
const { genreId } = req.params;
|
|
1267
|
+
const limit = parseInt(req.query.limit) || 50;
|
|
1268
|
+
const skip = parseInt(req.query.skip) || 0;
|
|
1269
|
+
const tracks = await db.track.find({
|
|
1270
|
+
genre: genreId,
|
|
1271
|
+
status: "published",
|
|
1272
|
+
isPublic: true
|
|
1273
|
+
}).populate("artist", "name url").populate("album", "title url").sort({ playCount: -1, releaseDate: -1 }).skip(skip).limit(limit);
|
|
1274
|
+
res.json(tracks);
|
|
1275
|
+
} catch (error) {
|
|
1276
|
+
console.error(error);
|
|
1277
|
+
res.status(500).json({ error: error.message });
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
genresCRUD.addAction("popular", {
|
|
1282
|
+
method: "get",
|
|
1283
|
+
path: "/popular",
|
|
1284
|
+
auth: false,
|
|
1285
|
+
handler: async (req, res) => {
|
|
1286
|
+
try {
|
|
1287
|
+
const limit = parseInt(req.query.limit) || 20;
|
|
1288
|
+
const popularGenres = await db.genre.find({ status: "published" }).sort({ popularity: -1 }).limit(limit);
|
|
1289
|
+
res.json(popularGenres);
|
|
1290
|
+
} catch (error) {
|
|
1291
|
+
console.error(error);
|
|
1292
|
+
res.status(500).json({ error: error.message });
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
return genresCRUD;
|
|
1297
|
+
}
|
|
1298
|
+
const SearchController = function(app, db) {
|
|
1299
|
+
const logger = new Logger(db);
|
|
1300
|
+
const cache = new Cache();
|
|
1301
|
+
async function search(req, res) {
|
|
1302
|
+
try {
|
|
1303
|
+
const { query, type, limit = 10 } = req.query;
|
|
1304
|
+
if (!query || query.length < 2) {
|
|
1305
|
+
return res.status(400).json({ error: "Search query must be at least 2 characters" });
|
|
1306
|
+
}
|
|
1307
|
+
const limitNum = parseInt(limit, 10);
|
|
1308
|
+
const cacheKey = `search:${query}:${type || "all"}:${limitNum}`;
|
|
1309
|
+
let results = await cache.get(cacheKey);
|
|
1310
|
+
if (!results) {
|
|
1311
|
+
results = {};
|
|
1312
|
+
const searchRegex = new RegExp(query, "i");
|
|
1313
|
+
const types = type ? [type] : ["tracks", "albums", "artists", "playlists", "genres"];
|
|
1314
|
+
if (types.includes("tracks") || types.includes("all")) {
|
|
1315
|
+
results.tracks = await db.track.find({
|
|
1316
|
+
$or: [{ title: searchRegex }, { tags: searchRegex }],
|
|
1317
|
+
status: "published",
|
|
1318
|
+
isPublic: true
|
|
1319
|
+
}).limit(limitNum);
|
|
1320
|
+
}
|
|
1321
|
+
if (types.includes("albums") || types.includes("all")) {
|
|
1322
|
+
results.albums = await db.album.find({
|
|
1323
|
+
$or: [{ title: searchRegex }, { description: searchRegex }, { tags: searchRegex }],
|
|
1324
|
+
status: "published",
|
|
1325
|
+
isPublic: true
|
|
1326
|
+
}).limit(limitNum);
|
|
1327
|
+
}
|
|
1328
|
+
if (types.includes("artists") || types.includes("all")) {
|
|
1329
|
+
results.artists = await db.artist.find({
|
|
1330
|
+
$or: [{ name: searchRegex }, { bio: searchRegex }, { tags: searchRegex }],
|
|
1331
|
+
status: "published"
|
|
1332
|
+
}).limit(limitNum);
|
|
1333
|
+
}
|
|
1334
|
+
if (types.includes("playlists") || types.includes("all")) {
|
|
1335
|
+
results.playlists = await db.playlist.find({
|
|
1336
|
+
$or: [{ title: searchRegex }, { description: searchRegex }, { tags: searchRegex }],
|
|
1337
|
+
isPublic: true
|
|
1338
|
+
}).limit(limitNum);
|
|
1339
|
+
}
|
|
1340
|
+
if (types.includes("genres") || types.includes("all")) {
|
|
1341
|
+
results.genres = await db.genre.find({
|
|
1342
|
+
$or: [{ name: searchRegex }, { description: searchRegex }],
|
|
1343
|
+
status: "published"
|
|
1344
|
+
}).limit(limitNum);
|
|
1345
|
+
}
|
|
1346
|
+
await cache.set(cacheKey, results, 600);
|
|
1347
|
+
}
|
|
1348
|
+
res.json(results);
|
|
1349
|
+
} catch (error) {
|
|
1350
|
+
logger.error(`Error searching: ${error.message}`);
|
|
1351
|
+
res.status(500).json({ error: error.message });
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return {
|
|
1355
|
+
search
|
|
1356
|
+
};
|
|
1357
|
+
};
|
|
1358
|
+
const StreamController = function(app, db, publicPath) {
|
|
1359
|
+
const { getInstance: getInstance2 } = globalsabac;
|
|
1360
|
+
const logger = new Logger(db);
|
|
1361
|
+
const abac = getInstance2(db);
|
|
1362
|
+
async function streamAudio(req, res) {
|
|
1363
|
+
try {
|
|
1364
|
+
const trackId = req.params.trackId;
|
|
1365
|
+
const track = await db.track.findById(trackId);
|
|
1366
|
+
if (!track) {
|
|
1367
|
+
return res.status(404).json({ error: "Track not found" });
|
|
1368
|
+
}
|
|
1369
|
+
const accessResult = await abac.checkAccess({
|
|
1370
|
+
user: req.userId,
|
|
1371
|
+
resource: "tracks",
|
|
1372
|
+
action: "read",
|
|
1373
|
+
currentResource: track
|
|
1374
|
+
});
|
|
1375
|
+
if (!accessResult.allowed && !track.isPublic) {
|
|
1376
|
+
return res.status(403).json({
|
|
1377
|
+
errorCode: accessResult.reason,
|
|
1378
|
+
message: "Access Denied"
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
const fileUrl = track.fileUrl;
|
|
1382
|
+
console.log("public is", publicPath);
|
|
1383
|
+
const filePath = path$1.join(publicPath, fileUrl);
|
|
1384
|
+
if (!fs$1.existsSync(filePath)) {
|
|
1385
|
+
logger.error(`File not found: ${filePath}`);
|
|
1386
|
+
return res.status(404).json({ error: "Audio file not found" });
|
|
1387
|
+
}
|
|
1388
|
+
const stat = fs$1.statSync(filePath);
|
|
1389
|
+
const fileSize = stat.size;
|
|
1390
|
+
const range = req.headers.range;
|
|
1391
|
+
if (req.userId) {
|
|
1392
|
+
try {
|
|
1393
|
+
await db.playHistory.create({
|
|
1394
|
+
user: req.userId,
|
|
1395
|
+
track: trackId,
|
|
1396
|
+
playedAt: /* @__PURE__ */ new Date(),
|
|
1397
|
+
deviceInfo: req.headers["user-agent"],
|
|
1398
|
+
playedFrom: req.query.from || "other",
|
|
1399
|
+
contextId: req.query.contextId || null
|
|
1400
|
+
});
|
|
1401
|
+
await db.track.findByIdAndUpdate(trackId, { $inc: { playCount: 1 } });
|
|
1402
|
+
} catch (error) {
|
|
1403
|
+
logger.error(`Error logging play history: ${error.message}`);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
if (range) {
|
|
1407
|
+
const parts = range.replace(/bytes=/, "").split("-");
|
|
1408
|
+
const start = parseInt(parts[0], 10);
|
|
1409
|
+
const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
|
|
1410
|
+
const chunksize = end - start + 1;
|
|
1411
|
+
const file = fs$1.createReadStream(filePath, { start, end });
|
|
1412
|
+
res.writeHead(206, {
|
|
1413
|
+
"Content-Range": `bytes ${start}-${end}/${fileSize}`,
|
|
1414
|
+
"Accept-Ranges": "bytes",
|
|
1415
|
+
"Content-Length": chunksize,
|
|
1416
|
+
"Content-Type": "audio/mpeg"
|
|
1417
|
+
});
|
|
1418
|
+
file.pipe(res);
|
|
1419
|
+
} else {
|
|
1420
|
+
res.writeHead(200, {
|
|
1421
|
+
"Content-Length": fileSize,
|
|
1422
|
+
"Content-Type": "audio/mpeg"
|
|
1423
|
+
});
|
|
1424
|
+
fs$1.createReadStream(filePath).pipe(res);
|
|
1425
|
+
}
|
|
1426
|
+
} catch (error) {
|
|
1427
|
+
logger.error(`Error streaming audio: ${error.message}`);
|
|
1428
|
+
res.status(500).json({ error: error.message });
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return {
|
|
1432
|
+
streamAudio
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
const AlbumModel = function(db) {
|
|
1436
|
+
const albumSchema = new db.mongoose.Schema(
|
|
1437
|
+
{
|
|
1438
|
+
title: {
|
|
1439
|
+
type: String,
|
|
1440
|
+
required: true
|
|
1441
|
+
},
|
|
1442
|
+
description: {
|
|
1443
|
+
type: String,
|
|
1444
|
+
default: ""
|
|
1445
|
+
},
|
|
1446
|
+
releaseDate: {
|
|
1447
|
+
type: Date,
|
|
1448
|
+
required: true
|
|
1449
|
+
},
|
|
1450
|
+
coverArt: {
|
|
1451
|
+
type: String,
|
|
1452
|
+
default: null
|
|
1453
|
+
},
|
|
1454
|
+
artists: [
|
|
1455
|
+
{
|
|
1456
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
1457
|
+
ref: "Artist",
|
|
1458
|
+
required: true
|
|
1459
|
+
}
|
|
1460
|
+
],
|
|
1461
|
+
type: {
|
|
1462
|
+
type: String,
|
|
1463
|
+
enum: ["album", "single", "EP", "compilation"],
|
|
1464
|
+
default: "album"
|
|
1465
|
+
},
|
|
1466
|
+
genres: [
|
|
1467
|
+
{
|
|
1468
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
1469
|
+
ref: "Genre"
|
|
1470
|
+
}
|
|
1471
|
+
],
|
|
1472
|
+
totalTracks: {
|
|
1473
|
+
type: Number,
|
|
1474
|
+
default: 0
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
timestamps: true,
|
|
1479
|
+
versionKey: false
|
|
1480
|
+
}
|
|
1481
|
+
);
|
|
1482
|
+
applyOwnershipSchema(albumSchema, db);
|
|
1483
|
+
applyMetadataSchema(albumSchema);
|
|
1484
|
+
applyCommonSchema(albumSchema);
|
|
1485
|
+
applyEngagementSchema(albumSchema);
|
|
1486
|
+
albumSchema.index({ title: "text", description: "text" });
|
|
1487
|
+
albumSchema.index({ artists: 1 });
|
|
1488
|
+
albumSchema.index({ releaseDate: -1 });
|
|
1489
|
+
albumSchema.index({ type: 1 });
|
|
1490
|
+
albumSchema.index({ genres: 1 });
|
|
1491
|
+
return db.mongoose.models.Album || db.mongoose.model("Album", albumSchema);
|
|
1492
|
+
};
|
|
1493
|
+
const ArtistModel = function(db) {
|
|
1494
|
+
const mongoose = db.mongoose;
|
|
1495
|
+
const Schema = mongoose.Schema;
|
|
1496
|
+
const ArtistSchema = new Schema(
|
|
1497
|
+
{
|
|
1498
|
+
name: {
|
|
1499
|
+
type: String,
|
|
1500
|
+
required: true,
|
|
1501
|
+
trim: true
|
|
1502
|
+
},
|
|
1503
|
+
bio: {
|
|
1504
|
+
type: String,
|
|
1505
|
+
trim: true
|
|
1506
|
+
},
|
|
1507
|
+
photoUrl: {
|
|
1508
|
+
type: String
|
|
1509
|
+
},
|
|
1510
|
+
coverUrl: {
|
|
1511
|
+
type: String
|
|
1512
|
+
},
|
|
1513
|
+
genre: [
|
|
1514
|
+
{
|
|
1515
|
+
type: Schema.Types.ObjectId,
|
|
1516
|
+
ref: "Genre"
|
|
1517
|
+
}
|
|
1518
|
+
],
|
|
1519
|
+
isVerified: {
|
|
1520
|
+
type: Boolean,
|
|
1521
|
+
default: false
|
|
1522
|
+
},
|
|
1523
|
+
website: {
|
|
1524
|
+
type: String,
|
|
1525
|
+
trim: true
|
|
1526
|
+
},
|
|
1527
|
+
location: {
|
|
1528
|
+
type: String,
|
|
1529
|
+
trim: true
|
|
1530
|
+
},
|
|
1531
|
+
popularity: {
|
|
1532
|
+
type: Number,
|
|
1533
|
+
default: 0
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
timestamps: true,
|
|
1538
|
+
versionKey: false
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1541
|
+
applyCommonSchema(ArtistSchema);
|
|
1542
|
+
applyMetadataSchema(ArtistSchema);
|
|
1543
|
+
applyOwnershipSchema(ArtistSchema, db);
|
|
1544
|
+
applySocialsSchema(ArtistSchema);
|
|
1545
|
+
applyEngagementSchema(ArtistSchema);
|
|
1546
|
+
ArtistSchema.index({ name: "text", bio: "text" });
|
|
1547
|
+
ArtistSchema.index({ popularity: -1 });
|
|
1548
|
+
ArtistSchema.index({ isVerified: 1 });
|
|
1549
|
+
return mongoose.models.Artist || mongoose.model("Artist", ArtistSchema);
|
|
1550
|
+
};
|
|
1551
|
+
const GenreModel = function(db) {
|
|
1552
|
+
const mongoose = db.mongoose;
|
|
1553
|
+
const Schema = mongoose.Schema;
|
|
1554
|
+
const GenreSchema = new Schema(
|
|
1555
|
+
{
|
|
1556
|
+
name: {
|
|
1557
|
+
type: String,
|
|
1558
|
+
required: true,
|
|
1559
|
+
trim: true,
|
|
1560
|
+
unique: true
|
|
1561
|
+
},
|
|
1562
|
+
description: {
|
|
1563
|
+
type: String,
|
|
1564
|
+
trim: true
|
|
1565
|
+
},
|
|
1566
|
+
iconUrl: {
|
|
1567
|
+
type: String
|
|
1568
|
+
},
|
|
1569
|
+
popularity: {
|
|
1570
|
+
type: Number,
|
|
1571
|
+
default: 0
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
timestamps: true,
|
|
1576
|
+
versionKey: false
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
applyCommonSchema(GenreSchema);
|
|
1580
|
+
applyMetadataSchema(GenreSchema);
|
|
1581
|
+
GenreSchema.index({ name: "text", description: "text" });
|
|
1582
|
+
GenreSchema.index({ popularity: -1 });
|
|
1583
|
+
return mongoose.models.Genre || mongoose.model("Genre", GenreSchema);
|
|
1584
|
+
};
|
|
1585
|
+
const PlayHistoryModel = function(db) {
|
|
1586
|
+
const mongoose = db.mongoose;
|
|
1587
|
+
const Schema = mongoose.Schema;
|
|
1588
|
+
const PlayHistorySchema = new Schema(
|
|
1589
|
+
{
|
|
1590
|
+
user: {
|
|
1591
|
+
type: Schema.Types.ObjectId,
|
|
1592
|
+
ref: "User",
|
|
1593
|
+
required: true
|
|
1594
|
+
},
|
|
1595
|
+
track: {
|
|
1596
|
+
type: Schema.Types.ObjectId,
|
|
1597
|
+
ref: "Track",
|
|
1598
|
+
required: true
|
|
1599
|
+
},
|
|
1600
|
+
playedAt: {
|
|
1601
|
+
type: Date,
|
|
1602
|
+
default: Date.now
|
|
1603
|
+
},
|
|
1604
|
+
playDuration: {
|
|
1605
|
+
type: Number,
|
|
1606
|
+
default: 0
|
|
1607
|
+
},
|
|
1608
|
+
playedFrom: {
|
|
1609
|
+
type: String,
|
|
1610
|
+
enum: ["playlist", "album", "search", "recommendation", "artist", "other"],
|
|
1611
|
+
default: "other"
|
|
1612
|
+
},
|
|
1613
|
+
contextId: {
|
|
1614
|
+
type: Schema.Types.ObjectId,
|
|
1615
|
+
refPath: "playedFrom"
|
|
1616
|
+
},
|
|
1617
|
+
deviceInfo: {
|
|
1618
|
+
type: String
|
|
1619
|
+
},
|
|
1620
|
+
location: {
|
|
1621
|
+
type: String
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
timestamps: true,
|
|
1626
|
+
versionKey: false
|
|
1627
|
+
}
|
|
1628
|
+
);
|
|
1629
|
+
PlayHistorySchema.index({ user: 1, playedAt: -1 });
|
|
1630
|
+
PlayHistorySchema.index({ track: 1 });
|
|
1631
|
+
PlayHistorySchema.index({ playedAt: -1 });
|
|
1632
|
+
return mongoose.models.PlayHistory || mongoose.model("PlayHistory", PlayHistorySchema);
|
|
1633
|
+
};
|
|
1634
|
+
const PlaylistModel = function(db) {
|
|
1635
|
+
const mongoose = db.mongoose;
|
|
1636
|
+
const Schema = mongoose.Schema;
|
|
1637
|
+
const PlaylistSchema = new Schema(
|
|
1638
|
+
{
|
|
1639
|
+
title: {
|
|
1640
|
+
type: String,
|
|
1641
|
+
required: true,
|
|
1642
|
+
trim: true
|
|
1643
|
+
},
|
|
1644
|
+
description: {
|
|
1645
|
+
type: String,
|
|
1646
|
+
trim: true
|
|
1647
|
+
},
|
|
1648
|
+
coverUrl: {
|
|
1649
|
+
type: String
|
|
1650
|
+
},
|
|
1651
|
+
tracks: [
|
|
1652
|
+
{
|
|
1653
|
+
track: {
|
|
1654
|
+
type: Schema.Types.ObjectId,
|
|
1655
|
+
ref: "Track"
|
|
1656
|
+
},
|
|
1657
|
+
addedAt: {
|
|
1658
|
+
type: Date,
|
|
1659
|
+
default: Date.now
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
],
|
|
1663
|
+
isPublic: {
|
|
1664
|
+
type: Boolean,
|
|
1665
|
+
default: true
|
|
1666
|
+
},
|
|
1667
|
+
followers: {
|
|
1668
|
+
type: Number,
|
|
1669
|
+
default: 0
|
|
1670
|
+
},
|
|
1671
|
+
isCollaborative: {
|
|
1672
|
+
type: Boolean,
|
|
1673
|
+
default: false
|
|
1674
|
+
},
|
|
1675
|
+
collaborators: [
|
|
1676
|
+
{
|
|
1677
|
+
type: Schema.Types.ObjectId,
|
|
1678
|
+
ref: "User"
|
|
1679
|
+
}
|
|
1680
|
+
]
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
timestamps: true,
|
|
1684
|
+
versionKey: false
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
applyCommonSchema(PlaylistSchema);
|
|
1688
|
+
applyMetadataSchema(PlaylistSchema);
|
|
1689
|
+
applyOwnershipSchema(PlaylistSchema, db);
|
|
1690
|
+
applyEngagementSchema(PlaylistSchema);
|
|
1691
|
+
PlaylistSchema.index({ title: "text", description: "text" });
|
|
1692
|
+
PlaylistSchema.index({ isPublic: 1 });
|
|
1693
|
+
PlaylistSchema.index({ followers: -1 });
|
|
1694
|
+
PlaylistSchema.index({ "tracks.addedAt": -1 });
|
|
1695
|
+
return mongoose.models.Playlist || mongoose.model("Playlist", PlaylistSchema);
|
|
1696
|
+
};
|
|
1697
|
+
const TrackModel = function(db) {
|
|
1698
|
+
const mongoose = db.mongoose;
|
|
1699
|
+
const Schema = mongoose.Schema;
|
|
1700
|
+
const TrackSchema = new Schema(
|
|
1701
|
+
{
|
|
1702
|
+
title: {
|
|
1703
|
+
type: String,
|
|
1704
|
+
required: true,
|
|
1705
|
+
trim: true
|
|
1706
|
+
},
|
|
1707
|
+
artist: {
|
|
1708
|
+
type: Schema.Types.ObjectId,
|
|
1709
|
+
ref: "Artist",
|
|
1710
|
+
required: true
|
|
1711
|
+
},
|
|
1712
|
+
album: {
|
|
1713
|
+
type: Schema.Types.ObjectId,
|
|
1714
|
+
ref: "Album"
|
|
1715
|
+
},
|
|
1716
|
+
duration: {
|
|
1717
|
+
type: Number,
|
|
1718
|
+
default: 0
|
|
1719
|
+
},
|
|
1720
|
+
fileUrl: {
|
|
1721
|
+
type: String,
|
|
1722
|
+
required: true
|
|
1723
|
+
},
|
|
1724
|
+
coverUrl: {
|
|
1725
|
+
type: String
|
|
1726
|
+
},
|
|
1727
|
+
genre: [
|
|
1728
|
+
{
|
|
1729
|
+
type: Schema.Types.ObjectId,
|
|
1730
|
+
ref: "Genre"
|
|
1731
|
+
}
|
|
1732
|
+
],
|
|
1733
|
+
releaseDate: {
|
|
1734
|
+
type: Date,
|
|
1735
|
+
default: Date.now
|
|
1736
|
+
},
|
|
1737
|
+
isExplicit: {
|
|
1738
|
+
type: Boolean,
|
|
1739
|
+
default: false
|
|
1740
|
+
},
|
|
1741
|
+
lyrics: {
|
|
1742
|
+
type: String
|
|
1743
|
+
},
|
|
1744
|
+
playCount: {
|
|
1745
|
+
type: Number,
|
|
1746
|
+
default: 0
|
|
1747
|
+
},
|
|
1748
|
+
isPublic: {
|
|
1749
|
+
type: Boolean,
|
|
1750
|
+
default: true
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
timestamps: true,
|
|
1755
|
+
versionKey: false
|
|
1756
|
+
}
|
|
1757
|
+
);
|
|
1758
|
+
applyCommonSchema(TrackSchema);
|
|
1759
|
+
applyMetadataSchema(TrackSchema);
|
|
1760
|
+
applyOwnershipSchema(TrackSchema, db);
|
|
1761
|
+
applyEngagementSchema(TrackSchema);
|
|
1762
|
+
TrackSchema.index({ title: "text" });
|
|
1763
|
+
TrackSchema.index({ artist: 1 });
|
|
1764
|
+
TrackSchema.index({ album: 1 });
|
|
1765
|
+
TrackSchema.index({ releaseDate: -1 });
|
|
1766
|
+
TrackSchema.index({ playCount: -1 });
|
|
1767
|
+
TrackSchema.pre("save", function(next) {
|
|
1768
|
+
if (!this.url) {
|
|
1769
|
+
this.url = createFriendlyURL(`${this.title}-${this._id}`);
|
|
1770
|
+
}
|
|
1771
|
+
next();
|
|
1772
|
+
});
|
|
1773
|
+
TrackSchema.virtual("artistName").get(function() {
|
|
1774
|
+
return this.artist ? this.artist.name : "";
|
|
1775
|
+
});
|
|
1776
|
+
return mongoose.models.Track || mongoose.model("Track", TrackSchema);
|
|
1777
|
+
};
|
|
1778
|
+
const musicPolicies = function initializeMusicPolicies(abacAccessControl) {
|
|
1779
|
+
abacAccessControl.registerResourcePolicy("tracks", async (context) => {
|
|
1780
|
+
const { user, action, currentResource, resourceModel } = context;
|
|
1781
|
+
const ObjectId = abacAccessControl.db.mongoose.Types.ObjectId;
|
|
1782
|
+
if (action === "read" && currentResource?.status === "published" && currentResource?.isPublic === true) {
|
|
1783
|
+
return true;
|
|
1784
|
+
}
|
|
1785
|
+
if (action === "create") {
|
|
1786
|
+
if (context.data.creator && context.data.creator.target) {
|
|
1787
|
+
return context.data.creator.target.toString() === user.toString();
|
|
1788
|
+
}
|
|
1789
|
+
return false;
|
|
1790
|
+
}
|
|
1791
|
+
if (["update", "edit", "delete"].includes(action) && currentResource) {
|
|
1792
|
+
if (currentResource.owner && currentResource.owner.type === "Organization") {
|
|
1793
|
+
const Organization = abacAccessControl.db.organization;
|
|
1794
|
+
const org = await Organization.findOne({
|
|
1795
|
+
_id: currentResource.owner.target,
|
|
1796
|
+
members: { $elemMatch: { user: new ObjectId(user) } }
|
|
1797
|
+
});
|
|
1798
|
+
if (org) return true;
|
|
1799
|
+
}
|
|
1800
|
+
if (currentResource.creator && currentResource.creator.target && currentResource.creator.target.toString() === user.toString()) {
|
|
1801
|
+
return true;
|
|
1802
|
+
}
|
|
1803
|
+
return false;
|
|
1804
|
+
}
|
|
1805
|
+
return false;
|
|
1806
|
+
});
|
|
1807
|
+
abacAccessControl.registerResourcePolicy("albums", async (context) => {
|
|
1808
|
+
return abacAccessControl.policies.resources.tracks(context);
|
|
1809
|
+
});
|
|
1810
|
+
abacAccessControl.registerResourcePolicy("playlists", async (context) => {
|
|
1811
|
+
const { user, action, currentResource } = context;
|
|
1812
|
+
if (currentResource && currentResource.isCollaborative && currentResource.collaborators && currentResource.collaborators.some((collaborator) => collaborator.toString() === user.toString())) {
|
|
1813
|
+
if (action === "edit" || action === "update") {
|
|
1814
|
+
return true;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
return abacAccessControl.policies.resources.tracks(context);
|
|
1818
|
+
});
|
|
1819
|
+
abacAccessControl.registerResourcePolicy("artists", async (context) => {
|
|
1820
|
+
return abacAccessControl.policies.resources.tracks(context);
|
|
1821
|
+
});
|
|
1822
|
+
return abacAccessControl;
|
|
1823
|
+
};
|
|
1824
|
+
const searchRoutes = function(app, db, origins, publicPath) {
|
|
1825
|
+
const controller = SearchController(app, db);
|
|
1826
|
+
app.get("/api/music/search", controller.search);
|
|
1827
|
+
};
|
|
1828
|
+
const streamRoutes = function(app, db, origins, publicPath) {
|
|
1829
|
+
console.log("rouus publioc is", publicPath);
|
|
1830
|
+
const controller = StreamController(app, db, publicPath);
|
|
1831
|
+
app.get("/api/stream/:trackId", controller.streamAudio);
|
|
1832
|
+
app.get("/api/waveform/:trackId", async (req, res) => {
|
|
1833
|
+
try {
|
|
1834
|
+
const track = await db.track.findById(req.params.trackId);
|
|
1835
|
+
if (!track) {
|
|
1836
|
+
return res.status(404).json({ error: "Track not found" });
|
|
1837
|
+
}
|
|
1838
|
+
const waveformPath = path.join(process.env.FILE_STORAGE_PATH || "./uploads", `waveforms/${track._id}.json`);
|
|
1839
|
+
if (fs.existsSync(waveformPath)) {
|
|
1840
|
+
const waveformData = JSON.parse(fs.readFileSync(waveformPath, "utf8"));
|
|
1841
|
+
return res.json(waveformData);
|
|
1842
|
+
}
|
|
1843
|
+
res.status(404).json({ error: "Waveform data not found" });
|
|
1844
|
+
} catch (error) {
|
|
1845
|
+
console.error(error);
|
|
1846
|
+
res.status(500).json({ error: error.message });
|
|
1847
|
+
}
|
|
1848
|
+
});
|
|
1849
|
+
};
|
|
1850
|
+
const StreamingHandler = function(db) {
|
|
1851
|
+
const logger = new Logger(db);
|
|
1852
|
+
return {
|
|
1853
|
+
// Handle WebSocket messages for music streaming
|
|
1854
|
+
handleStreamingMessage: async (ws, message) => {
|
|
1855
|
+
try {
|
|
1856
|
+
const { action, data } = message;
|
|
1857
|
+
switch (action) {
|
|
1858
|
+
case "startPlaying":
|
|
1859
|
+
if (ws.userId && data.trackId) {
|
|
1860
|
+
await db.playHistory.create({
|
|
1861
|
+
user: ws.userId,
|
|
1862
|
+
track: data.trackId,
|
|
1863
|
+
playedAt: /* @__PURE__ */ new Date(),
|
|
1864
|
+
deviceInfo: data.deviceInfo || "Unknown",
|
|
1865
|
+
playedFrom: data.from || "other",
|
|
1866
|
+
contextId: data.contextId || null
|
|
1867
|
+
});
|
|
1868
|
+
await db.track.findByIdAndUpdate(data.trackId, { $inc: { playCount: 1 } });
|
|
1869
|
+
ws.send(
|
|
1870
|
+
JSON.stringify({
|
|
1871
|
+
type: "playAcknowledged",
|
|
1872
|
+
trackId: data.trackId
|
|
1873
|
+
})
|
|
1874
|
+
);
|
|
1875
|
+
}
|
|
1876
|
+
break;
|
|
1877
|
+
case "syncPosition":
|
|
1878
|
+
if (ws.userId && data.trackId && data.position) {
|
|
1879
|
+
const latestPlay = await db.playHistory.findOne({
|
|
1880
|
+
user: ws.userId,
|
|
1881
|
+
track: data.trackId
|
|
1882
|
+
}).sort({ playedAt: -1 });
|
|
1883
|
+
if (latestPlay) {
|
|
1884
|
+
latestPlay.playDuration = data.position;
|
|
1885
|
+
await latestPlay.save();
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
break;
|
|
1889
|
+
case "getRecommendations":
|
|
1890
|
+
if (ws.userId) {
|
|
1891
|
+
const recentTracks = await db.playHistory.find({
|
|
1892
|
+
user: ws.userId
|
|
1893
|
+
}).sort({ playedAt: -1 }).limit(10).populate("track");
|
|
1894
|
+
const recentGenres = /* @__PURE__ */ new Set();
|
|
1895
|
+
const recentArtists = /* @__PURE__ */ new Set();
|
|
1896
|
+
recentTracks.forEach((history) => {
|
|
1897
|
+
if (history.track) {
|
|
1898
|
+
if (history.track.genre) {
|
|
1899
|
+
history.track.genre.forEach((g) => recentGenres.add(g.toString()));
|
|
1900
|
+
}
|
|
1901
|
+
if (history.track.artist) {
|
|
1902
|
+
recentArtists.add(history.track.artist.toString());
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
const recommendations = await db.track.find({
|
|
1907
|
+
$or: [{ genre: { $in: Array.from(recentGenres) } }, { artist: { $in: Array.from(recentArtists) } }],
|
|
1908
|
+
_id: { $nin: recentTracks.map((h) => h.track._id) },
|
|
1909
|
+
// Exclude recently played
|
|
1910
|
+
status: "published",
|
|
1911
|
+
isPublic: true
|
|
1912
|
+
}).limit(10).populate("artist", "name").populate("album", "title coverUrl");
|
|
1913
|
+
ws.send(
|
|
1914
|
+
JSON.stringify({
|
|
1915
|
+
type: "recommendations",
|
|
1916
|
+
tracks: recommendations
|
|
1917
|
+
})
|
|
1918
|
+
);
|
|
1919
|
+
}
|
|
1920
|
+
break;
|
|
1921
|
+
case "joinListeningParty":
|
|
1922
|
+
if (ws.userId && data.partyId) {
|
|
1923
|
+
ws.listeningParty = data.partyId;
|
|
1924
|
+
global.webSocketManager.broadcastToModuleWithFilter("music-streaming", (socket) => socket.listeningParty === data.partyId, {
|
|
1925
|
+
type: "partyMemberJoined",
|
|
1926
|
+
userId: ws.userId,
|
|
1927
|
+
partyId: data.partyId
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
break;
|
|
1931
|
+
case "syncPartyPlayback":
|
|
1932
|
+
if (ws.userId && ws.listeningParty && data.trackId && data.position) {
|
|
1933
|
+
global.webSocketManager.broadcastToModuleWithFilter("music-streaming", (socket) => socket.listeningParty === ws.listeningParty && socket !== ws, {
|
|
1934
|
+
type: "partyPlaybackSync",
|
|
1935
|
+
trackId: data.trackId,
|
|
1936
|
+
position: data.position,
|
|
1937
|
+
isPlaying: data.isPlaying,
|
|
1938
|
+
timestamp: Date.now()
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
break;
|
|
1942
|
+
default:
|
|
1943
|
+
logger.info(`Unknown streaming action: ${action}`);
|
|
1944
|
+
}
|
|
1945
|
+
} catch (error) {
|
|
1946
|
+
logger.error(`Error in streaming handler: ${error.message}`);
|
|
1947
|
+
ws.send(
|
|
1948
|
+
JSON.stringify({
|
|
1949
|
+
type: "error",
|
|
1950
|
+
message: "An error occurred while processing your request"
|
|
1951
|
+
})
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
};
|
|
1957
|
+
function initializeMusic({ app, db, wss, origins, publicPath }) {
|
|
1958
|
+
db.track = TrackModel(db);
|
|
1959
|
+
db.playlist = PlaylistModel(db);
|
|
1960
|
+
db.album = AlbumModel(db);
|
|
1961
|
+
db.artist = ArtistModel(db);
|
|
1962
|
+
db.genre = GenreModel(db);
|
|
1963
|
+
db.playHistory = PlayHistoryModel(db);
|
|
1964
|
+
console.log("server publioc is", publicPath);
|
|
1965
|
+
if (app) {
|
|
1966
|
+
setupTracksRoutes(app, db);
|
|
1967
|
+
setupArtistsRoutes(app, db);
|
|
1968
|
+
setupAlbumsRoutes(app, db);
|
|
1969
|
+
setupPlaylistsRoutes(app, db);
|
|
1970
|
+
setupGenresRoutes(app, db);
|
|
1971
|
+
streamRoutes(app, db, origins, publicPath);
|
|
1972
|
+
searchRoutes(app, db);
|
|
1973
|
+
}
|
|
1974
|
+
const { getInstance: getInstance2 } = globalsabac;
|
|
1975
|
+
const abac = getInstance2(db);
|
|
1976
|
+
musicPolicies(abac);
|
|
1977
|
+
const { WebSocketManager: WebSocketManager$1 } = WebSocketManager;
|
|
1978
|
+
if (global.webSocketManager && global.webSocketManager instanceof WebSocketManager$1) {
|
|
1979
|
+
global.webSocketManager.registerModule("music-streaming", StreamingHandler(db).handleStreamingMessage);
|
|
1980
|
+
}
|
|
1981
|
+
new Cache({ ttlSeconds: 60 * 15 });
|
|
1982
|
+
const musicLogger = new Logger(db);
|
|
1983
|
+
musicLogger.info("Music module initialized");
|
|
1984
|
+
}
|
|
1985
|
+
const models = {
|
|
1986
|
+
TrackModel,
|
|
1987
|
+
PlaylistModel,
|
|
1988
|
+
AlbumModel,
|
|
1989
|
+
ArtistModel,
|
|
1990
|
+
GenreModel,
|
|
1991
|
+
PlayHistoryModel
|
|
1992
|
+
};
|
|
1993
|
+
const routes = {
|
|
1994
|
+
// NEW CRUD Routes
|
|
1995
|
+
setupTracksRoutes,
|
|
1996
|
+
setupArtistsRoutes,
|
|
1997
|
+
setupAlbumsRoutes,
|
|
1998
|
+
setupPlaylistsRoutes,
|
|
1999
|
+
setupGenresRoutes,
|
|
2000
|
+
// Legacy routes
|
|
2001
|
+
streamRoutes,
|
|
2002
|
+
searchRoutes
|
|
2003
|
+
};
|
|
2004
|
+
const controllers = {
|
|
2005
|
+
// Keep only non-CRUD controllers
|
|
2006
|
+
StreamController,
|
|
2007
|
+
SearchController
|
|
2008
|
+
};
|
|
2009
|
+
const music_server = {
|
|
2010
|
+
initialize: initializeMusic,
|
|
2011
|
+
models,
|
|
2012
|
+
routes,
|
|
2013
|
+
controllers
|
|
2014
|
+
};
|
|
2015
|
+
export {
|
|
2016
|
+
controllers,
|
|
2017
|
+
music_server as default,
|
|
2018
|
+
initializeMusic as initialize,
|
|
2019
|
+
models,
|
|
2020
|
+
routes
|
|
2021
|
+
};
|