@ozdao/prometheus-framework 0.2.52 → 0.2.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. package/dist/main-0a2437f4.js +91 -0
  2. package/dist/main-4fnApBsF.js +91 -0
  3. package/dist/main-cdd0be68.mjs +13628 -0
  4. package/dist/main-kjbLXQEa.mjs +13606 -0
  5. package/dist/main.css +1 -1
  6. package/dist/products.server.js +61 -49
  7. package/dist/products.server.mjs +61 -49
  8. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  9. package/dist/prometheus-framework/src/components/Button/Button.vue.js +2 -223
  10. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  11. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +223 -2
  12. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  13. package/dist/prometheus-framework/src/components/Field/Field.vue.js +2 -76
  14. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  15. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +78 -2
  16. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  17. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  18. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  19. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +2 -44
  20. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  21. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +44 -2
  22. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  23. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  24. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  26. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  28. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +3 -3
  30. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  32. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  34. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  36. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  37. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
  38. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  40. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  42. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  43. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
  44. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +1 -1
  46. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  48. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
  50. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  52. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
  54. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  56. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +1 -1
  58. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  60. package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.js +1 -1
  62. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  64. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  66. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
  68. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
  70. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  72. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  74. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  76. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  78. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  80. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  82. package/dist/prometheus-framework/src/modules/organizations/router/products.router.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/organizations/router/products.router.js +22 -0
  84. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +1 -0
  85. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +45 -0
  86. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.cjs +1 -0
  87. package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.js +4 -0
  88. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  90. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -0
  95. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +79 -0
  96. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -0
  97. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +193 -0
  98. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.cjs +1 -0
  99. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.js +4 -0
  100. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  102. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  104. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +67 -57
  106. package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.js +1 -1
  108. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  110. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  112. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +21 -18
  114. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  115. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  116. package/dist/prometheus-framework/src/modules/products/products.client.cjs +1 -1
  117. package/dist/prometheus-framework/src/modules/products/products.client.js +2 -2
  118. package/dist/prometheus-framework/src/modules/products/store/categories.cjs +1 -1
  119. package/dist/prometheus-framework/src/modules/products/store/categories.js +39 -27
  120. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  121. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  122. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  123. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  124. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  126. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  128. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  130. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +1 -1
  132. package/dist/prometheus-framework.cjs.js +1 -1
  133. package/dist/prometheus-framework.es.js +1 -1
  134. package/dist/style.css +1 -1
  135. package/dist/web-0066fd51.mjs +55 -0
  136. package/dist/web-6b9fa713.js +1 -0
  137. package/dist/web-ngl7bNhF.js +1 -0
  138. package/dist/web-t91TrxXa.mjs +55 -0
  139. package/package.json +1 -1
  140. package/src/components/Button/Button.vue +1 -3
  141. package/src/components/Field/Field.vue +3 -1
  142. package/src/modules/marketplace/components/sections/Filters.vue +7 -1
  143. package/src/modules/organizations/router/products.router.js +24 -4
  144. package/src/modules/products/components/blocks/CardCategory.vue +53 -0
  145. package/src/modules/products/components/pages/Categories.vue +90 -0
  146. package/src/modules/products/components/pages/CategoryEdit.vue +214 -0
  147. package/src/modules/products/components/pages/ProductEdit.vue +9 -1
  148. package/src/modules/products/components/sections/FilterProducts.vue +4 -1
  149. package/src/modules/products/controllers/categories.controller.js +30 -13
  150. package/src/modules/products/models/category.model.js +42 -32
  151. package/src/modules/products/products.client.js +4 -2
  152. package/src/modules/products/store/categories.js +17 -3
  153. package/src/modules/backoffice/components/admin/Categories.vue +0 -53
  154. package/src/modules/backoffice/components/admin/CategoryEdit.vue +0 -98
  155. package/src/modules/products/components/blocks/CategoryCard.vue +0 -42
  156. package/src/modules/products/router/products.router.js +0 -48
  157. /package/src/modules/{products → organizations}/components/pages/OrganizationCreate.vue +0 -0
  158. /package/src/modules/{products → organizations}/components/pages/OrganizationDetails.vue +0 -0
  159. /package/src/modules/{products → organizations}/components/pages/OrganizationDocuments.vue +0 -0
  160. /package/src/modules/{products → organizations}/components/pages/OrganizationPeople.vue +0 -0
@@ -81,6 +81,16 @@ var category_model = (mongoose) => {
81
81
  required: true,
82
82
  trim: true
83
83
  },
84
+ status: {
85
+ type: String,
86
+ enum: ["draft", "internal", "published", "removed"],
87
+ default: "draft",
88
+ required: true
89
+ },
90
+ order: {
91
+ type: Number,
92
+ required: true
93
+ },
84
94
  url: {
85
95
  type: String,
86
96
  required: true,
@@ -94,43 +104,39 @@ var category_model = (mongoose) => {
94
104
  },
95
105
  filters: {
96
106
  type: Array
97
- },
98
- owner: {
99
- type: {
100
- type: String,
101
- required: true
102
- },
103
- target: {
104
- type: mongoose.Schema.Types.ObjectId,
105
- ref: function(value) {
106
- if (this.owner.type === "user")
107
- return "User";
108
- if (this.owner.type === "organization")
109
- return "Organization";
110
- },
111
- required: true
112
- }
113
- },
114
- creator: {
115
- hidden: {
116
- type: Boolean,
117
- required: true
118
- },
119
- type: {
120
- type: String,
121
- required: true
122
- },
123
- target: {
124
- type: mongoose.Schema.Types.ObjectId,
125
- ref: function(value) {
126
- if (this.owner.type === "user")
127
- return "User";
128
- if (this.owner.type === "organization")
129
- return "Organization";
130
- },
131
- required: true
132
- }
133
107
  }
108
+ // owner: {
109
+ // type: {
110
+ // type: String,
111
+ // required: true
112
+ // },
113
+ // target: {
114
+ // type: mongoose.Schema.Types.ObjectId,
115
+ // ref: function (value) {
116
+ // if (this.owner.type === 'user') return 'User';
117
+ // if (this.owner.type === 'organization') return 'Organization';
118
+ // },
119
+ // required: true,
120
+ // },
121
+ // },
122
+ // creator: {
123
+ // hidden: {
124
+ // type: Boolean,
125
+ // required: true
126
+ // },
127
+ // type: {
128
+ // type: String,
129
+ // required: true
130
+ // },
131
+ // target: {
132
+ // type: mongoose.Schema.Types.ObjectId,
133
+ // ref: function (value) {
134
+ // if (this.owner.type === 'user') return 'User';
135
+ // if (this.owner.type === 'organization') return 'Organization';
136
+ // },
137
+ // required: true,
138
+ // },
139
+ // }
134
140
  }, {
135
141
  timestamps: {
136
142
  currentTime: () => Date.now()
@@ -723,7 +729,12 @@ const controllerFactory$3 = (db) => {
723
729
  const getCategories = async (req, res) => {
724
730
  console.log(Category);
725
731
  try {
726
- const categories = await Category.find({}).sort({ "order": "asc" }).exec();
732
+ let query = {};
733
+ let options = {};
734
+ if (req.query.status) {
735
+ query.status = req.query.status;
736
+ }
737
+ const categories = await Category.find(query, null, options).sort({ "order": "asc" }).exec();
727
738
  if (!categories) {
728
739
  return res.status(404).send({ message: "Categories not found." });
729
740
  }
@@ -734,22 +745,21 @@ const controllerFactory$3 = (db) => {
734
745
  }
735
746
  };
736
747
  const updateCategories = async (req, res) => {
748
+ console.log(req.body);
737
749
  try {
738
- const updates = req.body.all.map(async (categoryUpdated) => {
739
- const category = await Category.findOneAndUpdate(
740
- { url: categoryUpdated.url },
741
- { $set: categoryUpdated },
742
- { new: true }
743
- ).exec();
744
- if (!category) {
745
- throw new Error("Categories is not updated.");
750
+ const bulkOps = req.body.map((categoryUpdated) => ({
751
+ updateOne: {
752
+ filter: { url: categoryUpdated.url },
753
+ update: { $set: categoryUpdated },
754
+ upsert: false
746
755
  }
747
- });
748
- await Promise.all(updates);
749
- console.log("success");
756
+ }));
757
+ const result = await Category.bulkWrite(bulkOps, { ordered: false });
758
+ console.log("Success", result);
750
759
  res.status(200).send({ message: "Categories updated successfully." });
751
760
  } catch (err) {
752
- res.send({ message: err.message });
761
+ console.error("Error processing bulk update", err);
762
+ res.status(500).send({ message: err.message });
753
763
  }
754
764
  };
755
765
  const getCategory = async (req, res) => {
@@ -765,6 +775,8 @@ const controllerFactory$3 = (db) => {
765
775
  };
766
776
  const addCategory = async (req, res) => {
767
777
  try {
778
+ const highestOrderDoc = await Category.findOne().sort("-order");
779
+ req.body.order = highestOrderDoc ? highestOrderDoc.order + 1 : 1;
768
780
  const category = await Category.create(req.body);
769
781
  if (!category) {
770
782
  return res.status(404).send({ message: "Category is not created." });
@@ -79,6 +79,16 @@ var category_model = (mongoose) => {
79
79
  required: true,
80
80
  trim: true
81
81
  },
82
+ status: {
83
+ type: String,
84
+ enum: ["draft", "internal", "published", "removed"],
85
+ default: "draft",
86
+ required: true
87
+ },
88
+ order: {
89
+ type: Number,
90
+ required: true
91
+ },
82
92
  url: {
83
93
  type: String,
84
94
  required: true,
@@ -92,43 +102,39 @@ var category_model = (mongoose) => {
92
102
  },
93
103
  filters: {
94
104
  type: Array
95
- },
96
- owner: {
97
- type: {
98
- type: String,
99
- required: true
100
- },
101
- target: {
102
- type: mongoose.Schema.Types.ObjectId,
103
- ref: function(value) {
104
- if (this.owner.type === "user")
105
- return "User";
106
- if (this.owner.type === "organization")
107
- return "Organization";
108
- },
109
- required: true
110
- }
111
- },
112
- creator: {
113
- hidden: {
114
- type: Boolean,
115
- required: true
116
- },
117
- type: {
118
- type: String,
119
- required: true
120
- },
121
- target: {
122
- type: mongoose.Schema.Types.ObjectId,
123
- ref: function(value) {
124
- if (this.owner.type === "user")
125
- return "User";
126
- if (this.owner.type === "organization")
127
- return "Organization";
128
- },
129
- required: true
130
- }
131
105
  }
106
+ // owner: {
107
+ // type: {
108
+ // type: String,
109
+ // required: true
110
+ // },
111
+ // target: {
112
+ // type: mongoose.Schema.Types.ObjectId,
113
+ // ref: function (value) {
114
+ // if (this.owner.type === 'user') return 'User';
115
+ // if (this.owner.type === 'organization') return 'Organization';
116
+ // },
117
+ // required: true,
118
+ // },
119
+ // },
120
+ // creator: {
121
+ // hidden: {
122
+ // type: Boolean,
123
+ // required: true
124
+ // },
125
+ // type: {
126
+ // type: String,
127
+ // required: true
128
+ // },
129
+ // target: {
130
+ // type: mongoose.Schema.Types.ObjectId,
131
+ // ref: function (value) {
132
+ // if (this.owner.type === 'user') return 'User';
133
+ // if (this.owner.type === 'organization') return 'Organization';
134
+ // },
135
+ // required: true,
136
+ // },
137
+ // }
132
138
  }, {
133
139
  timestamps: {
134
140
  currentTime: () => Date.now()
@@ -721,7 +727,12 @@ const controllerFactory$3 = (db) => {
721
727
  const getCategories = async (req, res) => {
722
728
  console.log(Category);
723
729
  try {
724
- const categories = await Category.find({}).sort({ "order": "asc" }).exec();
730
+ let query = {};
731
+ let options = {};
732
+ if (req.query.status) {
733
+ query.status = req.query.status;
734
+ }
735
+ const categories = await Category.find(query, null, options).sort({ "order": "asc" }).exec();
725
736
  if (!categories) {
726
737
  return res.status(404).send({ message: "Categories not found." });
727
738
  }
@@ -732,22 +743,21 @@ const controllerFactory$3 = (db) => {
732
743
  }
733
744
  };
734
745
  const updateCategories = async (req, res) => {
746
+ console.log(req.body);
735
747
  try {
736
- const updates = req.body.all.map(async (categoryUpdated) => {
737
- const category = await Category.findOneAndUpdate(
738
- { url: categoryUpdated.url },
739
- { $set: categoryUpdated },
740
- { new: true }
741
- ).exec();
742
- if (!category) {
743
- throw new Error("Categories is not updated.");
748
+ const bulkOps = req.body.map((categoryUpdated) => ({
749
+ updateOne: {
750
+ filter: { url: categoryUpdated.url },
751
+ update: { $set: categoryUpdated },
752
+ upsert: false
744
753
  }
745
- });
746
- await Promise.all(updates);
747
- console.log("success");
754
+ }));
755
+ const result = await Category.bulkWrite(bulkOps, { ordered: false });
756
+ console.log("Success", result);
748
757
  res.status(200).send({ message: "Categories updated successfully." });
749
758
  } catch (err) {
750
- res.send({ message: err.message });
759
+ console.error("Error processing bulk update", err);
760
+ res.status(500).send({ message: err.message });
751
761
  }
752
762
  };
753
763
  const getCategory = async (req, res) => {
@@ -763,6 +773,8 @@ const controllerFactory$3 = (db) => {
763
773
  };
764
774
  const addCategory = async (req, res) => {
765
775
  try {
776
+ const highestOrderDoc = await Category.findOne().sort("-order");
777
+ req.body.order = highestOrderDoc ? highestOrderDoc.order + 1 : 1;
766
778
  const category = await Category.create(req.body);
767
779
  if (!category) {
768
780
  return res.status(404).send({ message: "Category is not created." });
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue2.cjs");const u=["disabled"],d={key:1,class:"loading"},m=e.createElementVNode("svg",{class:"i-regular",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[e.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])],-1),b=[m],h={key:2,class:"t-semi loading t-black"},f={key:3,class:"error"},g={key:0,class:"button-counter"},v={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},setup(t){const n=t,a=e.ref(null),l=e.ref(null),o=e.ref(!1),r=e.ref(!1);async function c(){a.value.style["pointer-events"]="none",l.value=null,o.value=!0;const i=()=>{a.value&&(a.value.classList.replace("bg-second","bg-main"),a.value.style.pointerEvents="auto",o.value=!1,r.value=!1,l.value=null)};try{await n.submit(),a.value.classList.replace("bg-main","bg-second"),o.value=!1,n.showSucces?(r.value=!0,setTimeout(i,500)):i(),n.callback&&setTimeout(()=>n.callback(),n.callbackDelay)}catch{a.value.classList.replace("bg-main","bg-fourth-nano"),l.value=n.error,setTimeout(()=>{i(),a.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(i,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(c,["stop"]),disabled:t.validation,ref_key:"button",ref:a,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!o.value&&!l.value&&!r.value||!t.showLoader?e.renderSlot(i.$slots,"default",{key:0}):o.value&&!l.value&&t.showLoader?(e.openBlock(),e.createElementBlock("span",d,b)):r.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",h,e.toDisplayString(t.text.success),1)):l.value?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,u))}};exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
@@ -1,225 +1,4 @@
1
- import { ref as d, openBlock as u, createElementBlock as o, withModifiers as v, createVNode as g, Transition as y, withCtx as p, renderSlot as w, toDisplayString as b, createCommentVNode as h, createElementVNode as e, createTextVNode as r } from "vue";
2
- import "./Button.vue2.js";
3
- const k = ["disabled"], x = {
4
- key: 1,
5
- class: "loading"
6
- }, N = /* @__PURE__ */ e("svg", {
7
- class: "i-regular",
8
- width: "135",
9
- height: "140",
10
- viewBox: "0 0 135 140",
11
- xmlns: "http://www.w3.org/2000/svg",
12
- fill: "#fff"
13
- }, [
14
- /* @__PURE__ */ e("rect", {
15
- y: "10",
16
- width: "15",
17
- height: "120",
18
- rx: "6"
19
- }, [
20
- /* @__PURE__ */ e("animate", {
21
- attributeName: "height",
22
- begin: "0.5s",
23
- dur: "1s",
24
- values: "120;110;100;90;80;70;60;50;40;140;120",
25
- calcMode: "linear",
26
- repeatCount: "indefinite"
27
- }),
28
- /* @__PURE__ */ r(),
29
- /* @__PURE__ */ e("animate", {
30
- attributeName: "y",
31
- begin: "0.5s",
32
- dur: "1s",
33
- values: "10;15;20;25;30;35;40;45;50;0;10",
34
- calcMode: "linear",
35
- repeatCount: "indefinite"
36
- })
37
- ]),
38
- /* @__PURE__ */ e("rect", {
39
- x: "30",
40
- y: "10",
41
- width: "15",
42
- height: "120",
43
- rx: "6"
44
- }, [
45
- /* @__PURE__ */ e("animate", {
46
- attributeName: "height",
47
- begin: "0.25s",
48
- dur: "1s",
49
- values: "120;110;100;90;80;70;60;50;40;140;120",
50
- calcMode: "linear",
51
- repeatCount: "indefinite"
52
- }),
53
- /* @__PURE__ */ r(),
54
- /* @__PURE__ */ e("animate", {
55
- attributeName: "y",
56
- begin: "0.25s",
57
- dur: "1s",
58
- values: "10;15;20;25;30;35;40;45;50;0;10",
59
- calcMode: "linear",
60
- repeatCount: "indefinite"
61
- })
62
- ]),
63
- /* @__PURE__ */ e("rect", {
64
- x: "60",
65
- width: "15",
66
- height: "140",
67
- rx: "6"
68
- }, [
69
- /* @__PURE__ */ e("animate", {
70
- attributeName: "height",
71
- begin: "0s",
72
- dur: "1s",
73
- values: "120;110;100;90;80;70;60;50;40;140;120",
74
- calcMode: "linear",
75
- repeatCount: "indefinite"
76
- }),
77
- /* @__PURE__ */ r(),
78
- /* @__PURE__ */ e("animate", {
79
- attributeName: "y",
80
- begin: "0s",
81
- dur: "1s",
82
- values: "10;15;20;25;30;35;40;45;50;0;10",
83
- calcMode: "linear",
84
- repeatCount: "indefinite"
85
- })
86
- ]),
87
- /* @__PURE__ */ e("rect", {
88
- x: "90",
89
- y: "10",
90
- width: "15",
91
- height: "120",
92
- rx: "6"
93
- }, [
94
- /* @__PURE__ */ e("animate", {
95
- attributeName: "height",
96
- begin: "0.25s",
97
- dur: "1s",
98
- values: "120;110;100;90;80;70;60;50;40;140;120",
99
- calcMode: "linear",
100
- repeatCount: "indefinite"
101
- }),
102
- /* @__PURE__ */ r(),
103
- /* @__PURE__ */ e("animate", {
104
- attributeName: "y",
105
- begin: "0.25s",
106
- dur: "1s",
107
- values: "10;15;20;25;30;35;40;45;50;0;10",
108
- calcMode: "linear",
109
- repeatCount: "indefinite"
110
- })
111
- ]),
112
- /* @__PURE__ */ e("rect", {
113
- x: "120",
114
- y: "10",
115
- width: "15",
116
- height: "120",
117
- rx: "6"
118
- }, [
119
- /* @__PURE__ */ e("animate", {
120
- attributeName: "height",
121
- begin: "0.5s",
122
- dur: "1s",
123
- values: "120;110;100;90;80;70;60;50;40;140;120",
124
- calcMode: "linear",
125
- repeatCount: "indefinite"
126
- }),
127
- /* @__PURE__ */ r(),
128
- /* @__PURE__ */ e("animate", {
129
- attributeName: "y",
130
- begin: "0.5s",
131
- dur: "1s",
132
- values: "10;15;20;25;30;35;40;45;50;0;10",
133
- calcMode: "linear",
134
- repeatCount: "indefinite"
135
- })
136
- ])
137
- ], -1), C = [
138
- N
139
- ], M = {
140
- key: 2,
141
- class: "t-semi loading t-black"
142
- }, B = {
143
- key: 3,
144
- class: "error"
145
- }, L = {
146
- key: 0,
147
- class: "button-counter"
148
- }, T = {
149
- __name: "Button",
150
- props: {
151
- submit: {
152
- type: Function,
153
- default: async () => {
154
- console.log("Button click.");
155
- }
156
- },
157
- text: {
158
- type: Object,
159
- default: (t) => (console.log(t), t = {
160
- ...t.text,
161
- success: "✔",
162
- error: "✖"
163
- })
164
- },
165
- counter: {
166
- type: Object
167
- },
168
- callback: {
169
- type: Function,
170
- default: async () => {
171
- console.log("Button callback.");
172
- }
173
- },
174
- callbackDelay: {
175
- type: Number,
176
- default: 750
177
- },
178
- showSucces: {
179
- type: Boolean,
180
- default: !0
181
- },
182
- showLoader: {
183
- type: Boolean,
184
- default: !0
185
- },
186
- validation: {
187
- type: Boolean,
188
- default: !1
189
- }
190
- },
191
- setup(t) {
192
- const n = t, a = d(null), i = d(null), l = d(!1), c = d(!1);
193
- async function f() {
194
- a.value.style["pointer-events"] = "none", i.value = null, l.value = !0;
195
- const s = () => {
196
- a.value && (a.value.classList.replace("bg-second", "bg-main"), a.value.style.pointerEvents = "auto", l.value = !1, c.value = !1, i.value = null);
197
- };
198
- try {
199
- await n.submit(), a.value.classList.replace("bg-main", "bg-second"), l.value = !1, n.showSucces ? (c.value = !0, setTimeout(s, 500)) : s(), n.callback && setTimeout(() => n.callback(), n.callbackDelay);
200
- } catch {
201
- a.value.classList.replace("bg-main", "bg-fourth-nano"), i.value = n.error, setTimeout(() => {
202
- s(), a.value.classList.replace("bg-fourth-nano", "bg-main");
203
- }, 1330);
204
- }
205
- }
206
- return (s, m) => (u(), o("button", {
207
- onClick: v(f, ["stop"]),
208
- disabled: t.validation,
209
- ref_key: "button",
210
- ref: a,
211
- class: "button"
212
- }, [
213
- g(y, { name: "moveFromTopAbsolute" }, {
214
- default: p(() => [
215
- !l.value && !i.value && !c.value || !t.showLoader ? w(s.$slots, "default", { key: 0 }) : l.value && !i.value && t.showLoader ? (u(), o("span", x, C)) : c.value && t.showSucces ? (u(), o("span", M, b(t.text.success), 1)) : i.value ? (u(), o("span", B, b(i.value), 1)) : h("", !0)
216
- ]),
217
- _: 3
218
- }),
219
- t.counter ? (u(), o("p", L, b(t.counter), 1)) : h("", !0)
220
- ], 8, k));
221
- }
222
- };
1
+ const e = "";
223
2
  export {
224
- T as default
3
+ e as default
225
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue.cjs");const u=["disabled"],d={key:1,class:"loading"},m=e.createElementVNode("svg",{class:"i-regular",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[e.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])],-1),b=[m],h={key:2,class:"t-semi loading t-black"},f={key:3,class:"error"},g={key:0,class:"button-counter"},v={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},setup(t){const n=t,a=e.ref(null),l=e.ref(null),o=e.ref(!1),r=e.ref(!1);async function c(){a.value.style["pointer-events"]="none",l.value=null,o.value=!0;const i=()=>{a.value&&(a.value.classList.replace("bg-second","bg-main"),a.value.style.pointerEvents="auto",o.value=!1,r.value=!1,l.value=null)};try{await n.submit(),a.value.classList.replace("bg-main","bg-second"),o.value=!1,n.showSucces?(r.value=!0,setTimeout(i,500)):i(),n.callback&&setTimeout(()=>n.callback(),n.callbackDelay)}catch{a.value.classList.replace("bg-main","bg-fourth-nano"),l.value=n.error,setTimeout(()=>{i(),a.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(i,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(c,["stop"]),disabled:t.validation,ref_key:"button",ref:a,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!o.value&&!l.value&&!r.value||!t.showLoader?e.renderSlot(i.$slots,"default",{key:0}):o.value&&!l.value&&t.showLoader?(e.openBlock(),e.createElementBlock("span",d,b)):r.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",h,e.toDisplayString(t.text.success),1)):l.value?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,u))}};exports.default=v;