@ozdao/prometheus-framework 0.2.130 → 0.2.132
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +0 -1
- package/dist/auth.server.mjs +0 -1
- package/dist/community.server.js +172 -31
- package/dist/community.server.mjs +172 -31
- package/dist/events.server.js +1 -1
- package/dist/events.server.mjs +1 -1
- package/dist/files.server.js +38 -4
- package/dist/files.server.mjs +38 -4
- package/dist/gallery.server.js +1 -1
- package/dist/gallery.server.mjs +1 -1
- package/dist/main-CI9l9xMs.js +92 -0
- package/dist/main-DPg58GOU.mjs +14509 -0
- package/dist/main.css +1 -1
- package/dist/orders.server.js +1 -1
- package/dist/orders.server.mjs +1 -1
- package/dist/organizations.server.js +4 -3
- package/dist/organizations.server.mjs +4 -3
- package/dist/products.server.js +2 -1
- package/dist/products.server.mjs +2 -1
- package/dist/prometheus-framework/src/components/Address/Address.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Address/Address.vue.js +89 -0
- package/dist/prometheus-framework/src/components/Address/Address.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Address/Address.vue2.js +22 -23
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +13 -13
- package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Button/Button.vue.js +95 -0
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js +26 -0
- package/dist/prometheus-framework/src/components/DatePicker/Calendar.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/DatePicker/Calendar.vue2.js +32 -33
- package/dist/prometheus-framework/src/components/Draggable/Draggable.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Draggable/Draggable.vue.js +75 -0
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.js +57 -0
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +93 -87
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +84 -0
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +32 -29
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.js +22 -23
- package/dist/prometheus-framework/src/components/FieldTags/FieldTags.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldTags/FieldTags.vue.js +39 -39
- package/dist/prometheus-framework/src/components/FieldTags/tag-input.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldTags/tag-input.vue2.js +5 -5
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.js +127 -0
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +46 -47
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.js +13 -0
- package/dist/prometheus-framework/src/components/PhotoViewer/PhotoViewer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/PhotoViewer/PhotoViewer.vue.js +22 -23
- package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/Select/Select.vue.js +103 -0
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +14 -15
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +9 -10
- package/dist/prometheus-framework/src/components/Upload/Upload.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Upload/Upload.vue.js +37 -34
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +31 -31
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +32 -32
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +20 -20
- package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/auth.js +11 -11
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/community.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/community.client.js +12 -14
- package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.js +55 -72
- package/dist/prometheus-framework/src/modules/community/components/blocks/FooterBlogpost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/blocks/FooterBlogpost.vue.js +57 -29
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +87 -77
- package/dist/prometheus-framework/src/modules/community/components/pages/Blog.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Blog.vue.js +58 -28
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +71 -80
- package/dist/prometheus-framework/src/modules/community/components/sections/Comment.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/community/components/sections/Comment.vue.js +104 -0
- package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.js +99 -54
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +29 -30
- package/dist/prometheus-framework/src/modules/community/store/blogposts.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/store/blogposts.js +45 -34
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Audio.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Audio.vue.js +31 -29
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/ImageUpload.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/ImageUpload.vue.js +32 -27
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -0
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +67 -0
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Video.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Video.vue.js +16 -16
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +119 -112
- package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +6 -6
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.js +21 -21
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +30 -30
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockFilter.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockFilter.vue.js +33 -22
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +18 -18
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.cjs +1 -1
- package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.js +3 -9
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +9 -9
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +39 -38
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +113 -86
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +37 -36
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +10 -10
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +5 -5
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Publics.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Publics.vue.js +17 -17
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +18 -18
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +6 -6
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +12 -12
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +3 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.js +32 -37
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +5 -5
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +14 -14
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +33 -33
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +53 -35
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CardBalanceReplenished.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CardBalanceReplenished.vue.js +30 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CardDeposite.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CardDeposite.vue.js +42 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CashDeposite.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CashDeposite.vue.js +26 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CryptoDeposite.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/wallet/components/blocks/CryptoDeposite.vue.js +42 -0
- package/dist/prometheus-framework/src/modules/wallet/localization/Wallet.json.cjs +1 -0
- package/dist/prometheus-framework/src/modules/wallet/localization/Wallet.json.js +26 -0
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +158 -81
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +14 -14
- package/dist/queryProcessor-DQSFR9YA.mjs +179 -0
- package/dist/queryProcessor-iewDZq_f.js +178 -0
- package/dist/style.css +1 -1
- package/dist/wallet.server.js +80 -27
- package/dist/wallet.server.mjs +80 -27
- package/dist/web-DZUec7pP.js +1 -0
- package/dist/web-krQQeSb6.mjs +54 -0
- package/package.json +1 -1
- package/src/components/Address/Address.vue +1 -1
- package/src/components/Chips/Chips.vue +1 -1
- package/src/components/Completion/Completion.vue +1 -4
- package/src/components/DatePicker/Calendar.vue +1 -1
- package/src/components/Draggable/Draggable.vue +113 -0
- package/src/components/Dropdown/Dropdown.vue +1 -1
- package/src/components/Feed/Feed.vue +18 -12
- package/src/components/FieldBig/FieldBig.vue +11 -1
- package/src/components/FieldPhone/FieldPhone.vue +1 -1
- package/src/components/FieldTags/FieldTags.vue +2 -1
- package/src/components/FieldTags/tag-input.vue +1 -1
- package/src/components/LocationMarker/LocationMarker.vue +1 -1
- package/src/components/PhotoViewer/PhotoViewer.vue +1 -1
- package/src/components/Shader/Shader.vue +2 -2
- package/src/components/Slider/Slider.vue +1 -5
- package/src/components/Spoiler/Spoiler.vue +1 -1
- package/src/components/Text/Text.vue +1 -4
- package/src/components/Tooltip/Tooltip.vue +1 -1
- package/src/components/Upload/Upload.vue +5 -3
- package/src/modules/auth/controllers/auth.controller.js +0 -2
- package/src/modules/auth/store/auth.js +2 -2
- package/src/modules/community/DOCUMENTATION.MD +4 -0
- package/src/modules/community/community.client.js +0 -2
- package/src/modules/community/components/blocks/CardBlogpost.vue +6 -2
- package/src/modules/community/components/blocks/FooterBlogpost.vue +21 -5
- package/src/modules/community/components/layouts/Community.vue +15 -11
- package/src/modules/community/components/pages/Blog.vue +25 -32
- package/src/modules/community/components/pages/CreateBlogPost.vue +8 -15
- package/src/modules/community/components/sections/Comment.vue +123 -0
- package/src/modules/community/components/sections/Comments.vue +90 -19
- package/src/modules/community/components/sections/HotPosts.vue +3 -6
- package/src/modules/community/controllers/blog.controller.js +1 -1
- package/src/modules/community/controllers/comments.controller.aggr.js +280 -0
- package/src/modules/community/controllers/comments.controller.js +187 -38
- package/src/modules/community/controllers/comments.controller.populate.js +180 -0
- package/src/modules/community/models/comment.model.js +15 -0
- package/src/modules/community/store/blogposts.js +20 -2
- package/src/modules/constructor/components/elements/Audio.vue +28 -40
- package/src/modules/constructor/components/elements/ImageUpload.vue +12 -7
- package/src/modules/constructor/components/elements/Video.vue +10 -18
- package/src/modules/constructor/components/sections/Constructor.vue +54 -47
- package/src/modules/files/controllers/files.controller.js +2 -0
- package/src/modules/files/middlewares/server/middlewareBusboy.js +32 -4
- package/src/modules/files/routes/files.routes.js +8 -0
- package/src/modules/globals/components/blocks/BlockFilter.vue +17 -7
- package/src/modules/globals/components/partials/Header.vue +12 -7
- package/src/modules/globals/controllers/utils/queryProcessor.js +1 -0
- package/src/modules/icons/logos/Logotype.vue +8 -6
- package/src/modules/icons/logos/LogotypeNunito.vue +12 -0
- package/src/modules/marketplace/components/layouts/Marketplace.vue +29 -27
- package/src/modules/marketplace/store/marketplace.js +2 -8
- package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
- package/src/modules/organizations/components/pages/Members.vue +1 -1
- package/src/modules/organizations/components/pages/Organization.vue +33 -5
- package/src/modules/organizations/components/pages/OrganizationEdit.vue +7 -4
- package/src/modules/organizations/components/sections/DetailsTab.vue +10 -10
- package/src/modules/organizations/components/sections/Publics.vue +2 -2
- package/src/modules/organizations/controllers/memberships.controller.js +2 -3
- package/src/modules/organizations/controllers/organizations.controller.js +1 -1
- package/src/modules/organizations/store/memberships.js +4 -1
- package/src/modules/products/components/blocks/CardProduct.vue +1 -1
- package/src/modules/products/components/sections/HeroRecommendation.vue +11 -8
- package/src/modules/products/models/product.model.js +2 -1
- package/src/modules/spots/components/layouts/Spots.vue +0 -3
- package/src/modules/spots/components/pages/Map.vue +13 -3
- package/src/modules/users/components/blocks/CardUser.vue +2 -2
- package/src/modules/users/components/pages/ProfileBlogposts.vue +45 -28
- package/src/modules/wallet/components/blocks/CardBalanceReplenished.vue +40 -0
- package/src/modules/wallet/components/blocks/CardDeposite.vue +55 -0
- package/src/modules/wallet/components/blocks/CashDeposite.vue +28 -0
- package/src/modules/wallet/components/blocks/CryptoDeposite.vue +55 -0
- package/src/modules/wallet/controllers/factories/rewards.factory.aggr.js +181 -0
- package/src/modules/wallet/controllers/factories/rewards.factory.js +87 -113
- package/src/modules/wallet/controllers/factories/rewards.factory.population.js +213 -0
- package/src/modules/wallet/localization/Wallet.json +22 -0
- package/src/modules/wallet/views/components/pages/Wallet.vue +153 -53
- package/src/styles/base/all.scss +16 -26
- package/src/styles/config.scss +70 -34
- package/src/styles/typography.scss +5 -5
- package/src/modules/community/components/sections/Feed.vue +0 -148
- package/src/modules/middlewares/server/accessors/AccessController.js +0 -33
- package/src/modules/middlewares/server/accessors/ReadDepartments.js +0 -101
@@ -0,0 +1,181 @@
|
|
1
|
+
const ObjectId = require('mongoose').Types.ObjectId;
|
2
|
+
const { BigNumber } = require('bignumber.js');
|
3
|
+
|
4
|
+
const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
|
5
|
+
|
6
|
+
const VIEWS_REWARD_COEFF = '0.1';
|
7
|
+
const WDT_DECIMALS = 8;
|
8
|
+
|
9
|
+
const calculateRewardForPost = (snapshot, viewsCount, reactionsCount, commentsCount) => {
|
10
|
+
|
11
|
+
console.log('views',viewsCount)
|
12
|
+
console.log('reactions',reactionsCount)
|
13
|
+
console.log('comments',commentsCount)
|
14
|
+
|
15
|
+
if (snapshot) {
|
16
|
+
return new BigNumber(Math.max(viewsCount - snapshot.views, 0))
|
17
|
+
.multipliedBy(VIEWS_REWARD_COEFF)
|
18
|
+
.plus(Math.max(reactionsCount - snapshot.reactions, 0))
|
19
|
+
.plus(Math.max(commentsCount - snapshot.comments, 0));
|
20
|
+
}
|
21
|
+
|
22
|
+
return new BigNumber('10')
|
23
|
+
.plus(new BigNumber(viewsCount).multipliedBy(VIEWS_REWARD_COEFF))
|
24
|
+
.plus(reactionsCount)
|
25
|
+
.plus(commentsCount);
|
26
|
+
};
|
27
|
+
|
28
|
+
const rewardsControllerFactory = (db, wdmClient) => {
|
29
|
+
const Blogpost = db.blogpost;
|
30
|
+
const Reaction = db.reaction;
|
31
|
+
const Comment = db.comment;
|
32
|
+
const Reward = db.reward;
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
const listRewards = async (req, res) => {
|
37
|
+
try {
|
38
|
+
const aggregationResults = await Blogpost.aggregate([
|
39
|
+
// Соответствие блогпостов для данного пользователя
|
40
|
+
{ $match: { "creator.target": new ObjectId(req.userId) } },
|
41
|
+
|
42
|
+
// Добавление информации о реакциях и комментариях
|
43
|
+
{
|
44
|
+
$lookup: {
|
45
|
+
from: "reactions",
|
46
|
+
localField: "_id",
|
47
|
+
foreignField: "target",
|
48
|
+
as: "reactions"
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
$lookup: {
|
53
|
+
from: "comments",
|
54
|
+
localField: "_id",
|
55
|
+
foreignField: "target",
|
56
|
+
as: "comments"
|
57
|
+
}
|
58
|
+
},
|
59
|
+
|
60
|
+
// Добавление информации о предыдущей награде
|
61
|
+
{
|
62
|
+
$lookup: {
|
63
|
+
from: "rewards",
|
64
|
+
let: { blogId: "$_id" },
|
65
|
+
pipeline: [
|
66
|
+
{
|
67
|
+
$match: {
|
68
|
+
$expr: {
|
69
|
+
$and: [
|
70
|
+
{ $eq: ["$user", req.userId] },
|
71
|
+
{ $eq: ["$type", "blogpost"] },
|
72
|
+
{ $eq: ["$target", "$$blogId"] }
|
73
|
+
]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
},
|
77
|
+
{ $sort: { createdAt: -1 } },
|
78
|
+
{ $limit: 1 }
|
79
|
+
],
|
80
|
+
as: "previousReward"
|
81
|
+
}
|
82
|
+
},
|
83
|
+
|
84
|
+
// Преобразование результатов
|
85
|
+
{
|
86
|
+
$project: {
|
87
|
+
_id: 1,
|
88
|
+
user: req.userId,
|
89
|
+
type: "blogpost",
|
90
|
+
views: 1,
|
91
|
+
reactionsCount: { $size: "$reactions" },
|
92
|
+
commentsCount: { $size: "$comments" },
|
93
|
+
previousReward: { $arrayElemAt: ["$previousReward", 0] },
|
94
|
+
name: 1,
|
95
|
+
content: 1,
|
96
|
+
url: 1
|
97
|
+
}
|
98
|
+
}
|
99
|
+
])
|
100
|
+
|
101
|
+
const rewards = aggregationResults.map(result => ({
|
102
|
+
user: result.user,
|
103
|
+
type: result.type,
|
104
|
+
amount: calculateRewardForPost(
|
105
|
+
result.previousReward?.snapshot,
|
106
|
+
result.views,
|
107
|
+
result.reactionsCount,
|
108
|
+
result.commentsCount
|
109
|
+
),
|
110
|
+
name: result.name,
|
111
|
+
content: result.content,
|
112
|
+
url: result.url
|
113
|
+
}));
|
114
|
+
|
115
|
+
res.status(200).send(rewards);
|
116
|
+
} catch (error) {
|
117
|
+
res.status(500).send({ message: "Произошла ошибка при получении наград", error: error.message });
|
118
|
+
}
|
119
|
+
};
|
120
|
+
|
121
|
+
const collectTokens = async (req, res) => {
|
122
|
+
const blogs = await Blogpost.find({ "creator.target": req.userId }).exec();
|
123
|
+
|
124
|
+
let totalRewards = new BigNumber(0);
|
125
|
+
|
126
|
+
for (const blog of blogs) {
|
127
|
+
const reactions = await Reaction.countDocuments({ target: { $in: blog._id } }).exec();
|
128
|
+
const comments = await Comment.countDocuments({ target: { $in: blog._id } }).exec();
|
129
|
+
|
130
|
+
const previousReward = await Reward
|
131
|
+
.findOne({ user: req.userId, type: 'blogpost', target: blog._id })
|
132
|
+
.sort({ createdAt: -1 })
|
133
|
+
.exec();
|
134
|
+
|
135
|
+
const reward = calculateRewardForPost(
|
136
|
+
previousReward?.snapshot,
|
137
|
+
blog.views,
|
138
|
+
reactions,
|
139
|
+
comments
|
140
|
+
);
|
141
|
+
|
142
|
+
if (reward.gt(0)) {
|
143
|
+
totalRewards = totalRewards.plus(reward);
|
144
|
+
|
145
|
+
const snapshot = {
|
146
|
+
views: previousReward ?
|
147
|
+
previousReward.snapshot.views < blog.views ? blog.views : previousReward.snapshot.views
|
148
|
+
: blog.views,
|
149
|
+
reactions: previousReward ?
|
150
|
+
previousReward.snapshot.reactions < reactions ? reactions : previousReward.snapshot.reactions
|
151
|
+
: reactions,
|
152
|
+
comments: previousReward ?
|
153
|
+
previousReward.snapshot.comments < comments ? comments : previousReward.snapshot.comments
|
154
|
+
: comments,
|
155
|
+
};
|
156
|
+
|
157
|
+
await Reward.create({
|
158
|
+
user: req.userId,
|
159
|
+
type: 'blogpost',
|
160
|
+
target: blog._id,
|
161
|
+
amount: reward.toString(),
|
162
|
+
snapshot: snapshot,
|
163
|
+
});
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
if (totalRewards.gt(0)) {
|
168
|
+
await wdmClient.transfer(
|
169
|
+
totalRewards.shiftedBy(WDT_DECIMALS).toString(),
|
170
|
+
req.body.recipient,
|
171
|
+
req.userId
|
172
|
+
);
|
173
|
+
}
|
174
|
+
|
175
|
+
res.status(200).send();
|
176
|
+
};
|
177
|
+
|
178
|
+
return { listRewards, collectTokens };
|
179
|
+
};
|
180
|
+
|
181
|
+
module.exports = rewardsControllerFactory;
|
@@ -7,6 +7,9 @@ const VIEWS_REWARD_COEFF = '0.1';
|
|
7
7
|
const WDT_DECIMALS = 8;
|
8
8
|
|
9
9
|
const calculateRewardForPost = (snapshot, viewsCount, reactionsCount, commentsCount) => {
|
10
|
+
|
11
|
+
console.log('snapshot',snapshot)
|
12
|
+
|
10
13
|
if (snapshot) {
|
11
14
|
return new BigNumber(Math.max(viewsCount - snapshot.views, 0))
|
12
15
|
.multipliedBy(VIEWS_REWARD_COEFF)
|
@@ -26,123 +29,94 @@ const rewardsControllerFactory = (db, wdmClient) => {
|
|
26
29
|
const Comment = db.comment;
|
27
30
|
const Reward = db.reward;
|
28
31
|
|
29
|
-
// const listRewards = async (req, res) => {
|
30
|
-
// try {
|
31
|
-
// const rewards = await Blogpost.aggregate([
|
32
|
-
// // Шаг 1: Фильтрация блогпостов по создателю
|
33
|
-
// { $match: { "creator.target": req.userId } },
|
34
|
-
// // Шаг 2: Соединение с Reaction для подсчета реакций
|
35
|
-
// {
|
36
|
-
// $lookup: {
|
37
|
-
// from: "reactions",
|
38
|
-
// localField: "_id",
|
39
|
-
// foreignField: "target",
|
40
|
-
// as: "reactions"
|
41
|
-
// }
|
42
|
-
// },
|
43
|
-
// // Шаг 3: Соединение с Comment для подсчета комментариев
|
44
|
-
// {
|
45
|
-
// $lookup: {
|
46
|
-
// from: "comments",
|
47
|
-
// localField: "_id",
|
48
|
-
// foreignField: "target",
|
49
|
-
// as: "comments"
|
50
|
-
// }
|
51
|
-
// },
|
52
|
-
// // Шаг 4: Соединение с Reward для получения предыдущих наград
|
53
|
-
// {
|
54
|
-
// $lookup: {
|
55
|
-
// from: "rewards",
|
56
|
-
// let: { blogId: "$_id", userId: req.userId },
|
57
|
-
// pipeline: [
|
58
|
-
// { $match: {
|
59
|
-
// $expr: {
|
60
|
-
// $and: [
|
61
|
-
// { $eq: ["$user", "$$userId"] },
|
62
|
-
// { $eq: ["$type", "blogpost"] },
|
63
|
-
// { $eq: ["$target", "$$blogId"] }
|
64
|
-
// ]
|
65
|
-
// }
|
66
|
-
// }
|
67
|
-
// },
|
68
|
-
// { $sort: { createdAt: -1 } },
|
69
|
-
// { $limit: 1 }
|
70
|
-
// ],
|
71
|
-
// as: "previousReward"
|
72
|
-
// }
|
73
|
-
// },
|
74
|
-
// // Шаг 5: Проецирование результата и преобразование массивов в счетчики
|
75
|
-
// {
|
76
|
-
// $project: {
|
77
|
-
// user: req.userId,
|
78
|
-
// type: 'blogpost',
|
79
|
-
// name: "$name",
|
80
|
-
// content: "$content",
|
81
|
-
// url: "$url",
|
82
|
-
// views: "$views",
|
83
|
-
// reactionsCount: { $size: "$reactions" },
|
84
|
-
// commentsCount: { $size: "$comments" },
|
85
|
-
// previousRewardSnapshot: { $arrayElemAt: ["$previousReward.snapshot", 0] },
|
86
|
-
// }
|
87
|
-
// }
|
88
|
-
// ]).exec();
|
89
|
-
|
90
|
-
// // Пересчет наград на основе полученных данных
|
91
|
-
// const calculatedRewards = rewards.map(reward => ({
|
92
|
-
// ...reward,
|
93
|
-
// amount: calculateRewardForPost(
|
94
|
-
// reward.previousRewardSnapshot,
|
95
|
-
// reward.views,
|
96
|
-
// reward.reactionsCount,
|
97
|
-
// reward.commentsCount
|
98
|
-
// ).toString(),
|
99
|
-
// }));
|
100
|
-
|
101
|
-
// res.status(200).send(calculatedRewards);
|
102
|
-
// } catch (error) {
|
103
|
-
// console.error("Error listing rewards:", error);
|
104
|
-
// res.status(500).send({ message: "Internal server error" });
|
105
|
-
// }
|
106
|
-
// };
|
107
|
-
|
108
|
-
const listRewards = async (req, res) => {
|
109
|
-
const blogs = await Blogpost.find({ "creator.target": req.userId }).exec();
|
110
|
-
|
111
|
-
const rewards = [];
|
112
32
|
|
113
|
-
for (const blog of blogs) {
|
114
|
-
const reactions = await Reaction.countDocuments({ target: { $in: blog._id } }).exec();
|
115
|
-
const comments = await Comment.countDocuments({ target: { $in: blog._id } }).exec();
|
116
33
|
|
117
|
-
|
118
|
-
.findOne({ user: req.userId, type: 'blogpost', target: blog._id })
|
119
|
-
.populate({
|
120
|
-
path: 'target',
|
121
|
-
model: 'Blogpost' // Убедитесь, что 'Blogpost' соответствует имени вашей модели блогпоста
|
122
|
-
})
|
123
|
-
.sort({ createdAt: -1 })
|
124
|
-
.exec();
|
125
|
-
|
126
|
-
const reward = calculateRewardForPost(
|
127
|
-
previousReward?.snapshot,
|
128
|
-
blog.views,
|
129
|
-
reactions,
|
130
|
-
comments
|
131
|
-
);
|
132
|
-
|
133
|
-
rewards.push({
|
134
|
-
user: req.userId,
|
135
|
-
type: 'blogpost',
|
136
|
-
amount: reward.toString(),
|
137
|
-
name: blog.name,
|
138
|
-
content: blog.content,
|
139
|
-
url: blog.url
|
140
|
-
});
|
34
|
+
const listRewards = async (req, res) => {
|
141
35
|
|
142
|
-
|
36
|
+
const userId = new ObjectId(req.userId)
|
37
|
+
|
38
|
+
try {
|
39
|
+
const aggregationResults = await Blogpost.aggregate([
|
40
|
+
// Соответствие блогпостов для данного пользователя
|
41
|
+
{ $match: { "creator.target": userId } },
|
42
|
+
|
43
|
+
// Добавление информации о реакциях и комментариях
|
44
|
+
{
|
45
|
+
$lookup: {
|
46
|
+
from: "reactions",
|
47
|
+
localField: "_id",
|
48
|
+
foreignField: "target",
|
49
|
+
as: "reactions"
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
$lookup: {
|
54
|
+
from: "comments",
|
55
|
+
localField: "_id",
|
56
|
+
foreignField: "target",
|
57
|
+
as: "comments"
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
// Добавление информации о предыдущей награде
|
62
|
+
{
|
63
|
+
$lookup: {
|
64
|
+
from: "rewards",
|
65
|
+
let: { blogId: "$_id" },
|
66
|
+
pipeline: [
|
67
|
+
{
|
68
|
+
$match: {
|
69
|
+
$expr: {
|
70
|
+
$and: [
|
71
|
+
{ $eq: ["$user", userId] },
|
72
|
+
{ $eq: ["$type", "blogpost"] },
|
73
|
+
{ $eq: ["$target", "$$blogId"] }
|
74
|
+
]
|
75
|
+
}
|
76
|
+
}
|
77
|
+
},
|
78
|
+
{ $sort: { createdAt: -1 } },
|
79
|
+
{ $limit: 1 }
|
80
|
+
],
|
81
|
+
as: "previousReward"
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
// Преобразование результатов
|
86
|
+
{
|
87
|
+
$project: {
|
88
|
+
_id: 1,
|
89
|
+
user: req.userId,
|
90
|
+
type: "blogpost",
|
91
|
+
views: 1,
|
92
|
+
reactionsCount: { $size: "$reactions" },
|
93
|
+
commentsCount: { $size: "$comments" },
|
94
|
+
previousReward: { $arrayElemAt: ["$previousReward", 0] },
|
95
|
+
name: 1,
|
96
|
+
content: 1,
|
97
|
+
url: 1
|
98
|
+
}
|
99
|
+
}
|
100
|
+
])
|
101
|
+
|
102
|
+
const rewards = aggregationResults.map(result => ({
|
103
|
+
user: result.user,
|
104
|
+
type: result.type,
|
105
|
+
amount: calculateRewardForPost(
|
106
|
+
result.previousReward?.snapshot,
|
107
|
+
result.views,
|
108
|
+
result.reactionsCount,
|
109
|
+
result.commentsCount
|
110
|
+
),
|
111
|
+
name: result.name,
|
112
|
+
content: result.content,
|
113
|
+
url: result.url
|
114
|
+
}));
|
115
|
+
|
116
|
+
res.status(200).send(rewards);
|
117
|
+
} catch (error) {
|
118
|
+
res.status(500).send({ message: "Произошла ошибка при получении наград", error: error.message });
|
143
119
|
}
|
144
|
-
|
145
|
-
res.status(200).send(rewards);
|
146
120
|
};
|
147
121
|
|
148
122
|
const collectTokens = async (req, res) => {
|
@@ -0,0 +1,213 @@
|
|
1
|
+
const ObjectId = require('mongoose').Types.ObjectId;
|
2
|
+
const { BigNumber } = require('bignumber.js');
|
3
|
+
|
4
|
+
const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
|
5
|
+
|
6
|
+
const VIEWS_REWARD_COEFF = '0.1';
|
7
|
+
const WDT_DECIMALS = 8;
|
8
|
+
|
9
|
+
const calculateRewardForPost = (snapshot, viewsCount, reactionsCount, commentsCount) => {
|
10
|
+
console.log('views',viewsCount)
|
11
|
+
console.log('reactions',reactionsCount)
|
12
|
+
console.log('comments',commentsCount)
|
13
|
+
|
14
|
+
|
15
|
+
if (snapshot) {
|
16
|
+
return new BigNumber(Math.max(viewsCount - snapshot.views, 0))
|
17
|
+
.multipliedBy(VIEWS_REWARD_COEFF)
|
18
|
+
.plus(Math.max(reactionsCount - snapshot.reactions, 0))
|
19
|
+
.plus(Math.max(commentsCount - snapshot.comments, 0));
|
20
|
+
}
|
21
|
+
|
22
|
+
return new BigNumber('10')
|
23
|
+
.plus(new BigNumber(viewsCount).multipliedBy(VIEWS_REWARD_COEFF))
|
24
|
+
.plus(reactionsCount)
|
25
|
+
.plus(commentsCount);
|
26
|
+
};
|
27
|
+
|
28
|
+
const rewardsControllerFactory = (db, wdmClient) => {
|
29
|
+
const Blogpost = db.blogpost;
|
30
|
+
const Reaction = db.reaction;
|
31
|
+
const Comment = db.comment;
|
32
|
+
const Reward = db.reward;
|
33
|
+
|
34
|
+
// const listRewards = async (req, res) => {
|
35
|
+
// try {
|
36
|
+
// const rewards = await Blogpost.aggregate([
|
37
|
+
// // Шаг 1: Фильтрация блогпостов по создателю
|
38
|
+
// { $match: { "creator.target": req.userId } },
|
39
|
+
// // Шаг 2: Соединение с Reaction для подсчета реакций
|
40
|
+
// {
|
41
|
+
// $lookup: {
|
42
|
+
// from: "reactions",
|
43
|
+
// localField: "_id",
|
44
|
+
// foreignField: "target",
|
45
|
+
// as: "reactions"
|
46
|
+
// }
|
47
|
+
// },
|
48
|
+
// // Шаг 3: Соединение с Comment для подсчета комментариев
|
49
|
+
// {
|
50
|
+
// $lookup: {
|
51
|
+
// from: "comments",
|
52
|
+
// localField: "_id",
|
53
|
+
// foreignField: "target",
|
54
|
+
// as: "comments"
|
55
|
+
// }
|
56
|
+
// },
|
57
|
+
// // Шаг 4: Соединение с Reward для получения предыдущих наград
|
58
|
+
// {
|
59
|
+
// $lookup: {
|
60
|
+
// from: "rewards",
|
61
|
+
// let: { blogId: "$_id", userId: req.userId },
|
62
|
+
// pipeline: [
|
63
|
+
// { $match: {
|
64
|
+
// $expr: {
|
65
|
+
// $and: [
|
66
|
+
// { $eq: ["$user", "$$userId"] },
|
67
|
+
// { $eq: ["$type", "blogpost"] },
|
68
|
+
// { $eq: ["$target", "$$blogId"] }
|
69
|
+
// ]
|
70
|
+
// }
|
71
|
+
// }
|
72
|
+
// },
|
73
|
+
// { $sort: { createdAt: -1 } },
|
74
|
+
// { $limit: 1 }
|
75
|
+
// ],
|
76
|
+
// as: "previousReward"
|
77
|
+
// }
|
78
|
+
// },
|
79
|
+
// // Шаг 5: Проецирование результата и преобразование массивов в счетчики
|
80
|
+
// {
|
81
|
+
// $project: {
|
82
|
+
// user: req.userId,
|
83
|
+
// type: 'blogpost',
|
84
|
+
// name: "$name",
|
85
|
+
// content: "$content",
|
86
|
+
// url: "$url",
|
87
|
+
// views: "$views",
|
88
|
+
// reactionsCount: { $size: "$reactions" },
|
89
|
+
// commentsCount: { $size: "$comments" },
|
90
|
+
// previousRewardSnapshot: { $arrayElemAt: ["$previousReward.snapshot", 0] },
|
91
|
+
// }
|
92
|
+
// }
|
93
|
+
// ]).exec();
|
94
|
+
|
95
|
+
// // Пересчет наград на основе полученных данных
|
96
|
+
// const calculatedRewards = rewards.map(reward => ({
|
97
|
+
// ...reward,
|
98
|
+
// amount: calculateRewardForPost(
|
99
|
+
// reward.previousRewardSnapshot,
|
100
|
+
// reward.views,
|
101
|
+
// reward.reactionsCount,
|
102
|
+
// reward.commentsCount
|
103
|
+
// ).toString(),
|
104
|
+
// }));
|
105
|
+
|
106
|
+
// res.status(200).send(calculatedRewards);
|
107
|
+
// } catch (error) {
|
108
|
+
// console.error("Error listing rewards:", error);
|
109
|
+
// res.status(500).send({ message: "Internal server error" });
|
110
|
+
// }
|
111
|
+
// };
|
112
|
+
|
113
|
+
const listRewards = async (req, res) => {
|
114
|
+
const blogs = await Blogpost.find({ "creator.target": req.userId }).exec();
|
115
|
+
|
116
|
+
const rewards = [];
|
117
|
+
|
118
|
+
for (const blog of blogs) {
|
119
|
+
const reactions = await Reaction.countDocuments({ target: { $in: blog._id } }).exec();
|
120
|
+
const comments = await Comment.countDocuments({ target: { $in: blog._id } }).exec();
|
121
|
+
|
122
|
+
const previousReward = await Reward
|
123
|
+
.findOne({ user: req.userId, type: 'blogpost', target: blog._id })
|
124
|
+
.populate({
|
125
|
+
path: 'target',
|
126
|
+
model: 'Blogpost' // Убедитесь, что 'Blogpost' соответствует имени вашей модели блогпоста
|
127
|
+
})
|
128
|
+
.sort({ createdAt: -1 })
|
129
|
+
.exec();
|
130
|
+
|
131
|
+
const reward = calculateRewardForPost(
|
132
|
+
previousReward?.snapshot,
|
133
|
+
blog.views,
|
134
|
+
reactions,
|
135
|
+
comments
|
136
|
+
);
|
137
|
+
|
138
|
+
rewards.push({
|
139
|
+
user: req.userId,
|
140
|
+
type: 'blogpost',
|
141
|
+
amount: reward.toString(),
|
142
|
+
name: blog.name,
|
143
|
+
content: blog.content,
|
144
|
+
url: blog.url
|
145
|
+
});
|
146
|
+
|
147
|
+
// console.log(rewards)
|
148
|
+
}
|
149
|
+
|
150
|
+
res.status(200).send(rewards);
|
151
|
+
};
|
152
|
+
|
153
|
+
const collectTokens = async (req, res) => {
|
154
|
+
const blogs = await Blogpost.find({ "creator.target": req.userId }).exec();
|
155
|
+
|
156
|
+
let totalRewards = new BigNumber(0);
|
157
|
+
|
158
|
+
for (const blog of blogs) {
|
159
|
+
const reactions = await Reaction.countDocuments({ target: { $in: blog._id } }).exec();
|
160
|
+
const comments = await Comment.countDocuments({ target: { $in: blog._id } }).exec();
|
161
|
+
|
162
|
+
const previousReward = await Reward
|
163
|
+
.findOne({ user: req.userId, type: 'blogpost', target: blog._id })
|
164
|
+
.sort({ createdAt: -1 })
|
165
|
+
.exec();
|
166
|
+
|
167
|
+
const reward = calculateRewardForPost(
|
168
|
+
previousReward?.snapshot,
|
169
|
+
blog.views,
|
170
|
+
reactions,
|
171
|
+
comments
|
172
|
+
);
|
173
|
+
|
174
|
+
if (reward.gt(0)) {
|
175
|
+
totalRewards = totalRewards.plus(reward);
|
176
|
+
|
177
|
+
const snapshot = {
|
178
|
+
views: previousReward ?
|
179
|
+
previousReward.snapshot.views < blog.views ? blog.views : previousReward.snapshot.views
|
180
|
+
: blog.views,
|
181
|
+
reactions: previousReward ?
|
182
|
+
previousReward.snapshot.reactions < reactions ? reactions : previousReward.snapshot.reactions
|
183
|
+
: reactions,
|
184
|
+
comments: previousReward ?
|
185
|
+
previousReward.snapshot.comments < comments ? comments : previousReward.snapshot.comments
|
186
|
+
: comments,
|
187
|
+
};
|
188
|
+
|
189
|
+
await Reward.create({
|
190
|
+
user: req.userId,
|
191
|
+
type: 'blogpost',
|
192
|
+
target: blog._id,
|
193
|
+
amount: reward.toString(),
|
194
|
+
snapshot: snapshot,
|
195
|
+
});
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
if (totalRewards.gt(0)) {
|
200
|
+
await wdmClient.transfer(
|
201
|
+
totalRewards.shiftedBy(WDT_DECIMALS).toString(),
|
202
|
+
req.body.recipient,
|
203
|
+
req.userId
|
204
|
+
);
|
205
|
+
}
|
206
|
+
|
207
|
+
res.status(200).send();
|
208
|
+
};
|
209
|
+
|
210
|
+
return { listRewards, collectTokens };
|
211
|
+
};
|
212
|
+
|
213
|
+
module.exports = rewardsControllerFactory;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"messages": {
|
3
|
+
"en-default": {
|
4
|
+
"pay": "pay",
|
5
|
+
"youReceived": "you received",
|
6
|
+
"enterAmount": "enter amount to top up",
|
7
|
+
"backToWallet": "back to wallet",
|
8
|
+
"backToSelection": "back to selection",
|
9
|
+
"balanceReplenished": "balance replenished",
|
10
|
+
"depositeWithCrypto": "deposite with crypto"
|
11
|
+
},
|
12
|
+
"ru-default": {
|
13
|
+
"pay": "купить",
|
14
|
+
"youReceived": "вы пополнили на сумму",
|
15
|
+
"enterAmount": "введите сумму для пополнения",
|
16
|
+
"backToWallet": "назад к кошельку",
|
17
|
+
"backToSelection": "назад к списку",
|
18
|
+
"balanceReplenished": "баланс пополнен",
|
19
|
+
"depositeWithCrypto": "пополнение криптовалютой"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|