@ozdao/prometheus-framework 0.2.252 → 0.2.254

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. package/dist/auth.server.js +298 -14
  2. package/dist/auth.server.mjs +298 -14
  3. package/dist/builder.js +4 -4
  4. package/dist/builder.mjs +4 -4
  5. package/dist/chats.server.js +110 -0
  6. package/dist/chats.server.mjs +111 -0
  7. package/dist/community.server.js +38 -21
  8. package/dist/community.server.mjs +38 -21
  9. package/dist/events.server.js +38 -18
  10. package/dist/events.server.mjs +38 -17
  11. package/dist/files.server.js +12 -3
  12. package/dist/files.server.mjs +12 -3
  13. package/dist/gallery.server.js +17 -4
  14. package/dist/gallery.server.mjs +17 -4
  15. package/dist/organizations.server.js +43 -26
  16. package/dist/organizations.server.mjs +43 -26
  17. package/dist/products.server.js +49 -23
  18. package/dist/products.server.mjs +49 -22
  19. package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +15 -3
  20. package/dist/prometheus-framework/src/modules/auth/auth.client.cjs.map +1 -1
  21. package/dist/prometheus-framework/src/modules/auth/auth.client.js +16 -4
  22. package/dist/prometheus-framework/src/modules/auth/auth.client.js.map +1 -1
  23. package/dist/prometheus-framework/src/modules/auth/views/components/blocks/CardUser.vue.cjs +95 -0
  24. package/dist/prometheus-framework/src/modules/auth/views/components/blocks/CardUser.vue.cjs.map +1 -0
  25. package/dist/prometheus-framework/src/modules/auth/views/components/blocks/CardUser.vue.js +95 -0
  26. package/dist/prometheus-framework/src/modules/auth/views/components/blocks/CardUser.vue.js.map +1 -0
  27. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue.cjs +284 -0
  28. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -0
  29. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue.js +284 -0
  30. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -0
  31. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue2.cjs +2 -0
  32. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue2.cjs.map +1 -0
  33. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue2.js +2 -0
  34. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Profile.vue2.js.map +1 -0
  35. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +85 -0
  36. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs.map +1 -0
  37. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +85 -0
  38. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js.map +1 -0
  39. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +176 -0
  40. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs.map +1 -0
  41. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue.js +176 -0
  42. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue.js.map +1 -0
  43. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue2.cjs +2 -0
  44. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue2.cjs.map +1 -0
  45. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue2.js +2 -0
  46. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ProfileEdit.vue2.js.map +1 -0
  47. package/dist/prometheus-framework/src/modules/auth/views/components/sections/FeaturedUsers.vue.cjs +114 -0
  48. package/dist/prometheus-framework/src/modules/auth/views/components/sections/FeaturedUsers.vue.cjs.map +1 -0
  49. package/dist/prometheus-framework/src/modules/auth/views/components/sections/FeaturedUsers.vue.js +114 -0
  50. package/dist/prometheus-framework/src/modules/auth/views/components/sections/FeaturedUsers.vue.js.map +1 -0
  51. package/dist/prometheus-framework/src/modules/auth/views/components/sections/ProfileCompletion.vue.cjs +72 -0
  52. package/dist/prometheus-framework/src/modules/auth/views/components/sections/ProfileCompletion.vue.cjs.map +1 -0
  53. package/dist/prometheus-framework/src/modules/auth/views/components/sections/ProfileCompletion.vue.js +72 -0
  54. package/dist/prometheus-framework/src/modules/auth/views/components/sections/ProfileCompletion.vue.js.map +1 -0
  55. package/dist/prometheus-framework/src/modules/auth/views/router/users.cjs +97 -0
  56. package/dist/prometheus-framework/src/modules/auth/views/router/users.cjs.map +1 -0
  57. package/dist/prometheus-framework/src/modules/auth/views/router/users.js +97 -0
  58. package/dist/prometheus-framework/src/modules/auth/views/router/users.js.map +1 -0
  59. package/dist/prometheus-framework/src/modules/auth/views/store/users.cjs +95 -0
  60. package/dist/prometheus-framework/src/modules/auth/views/store/users.cjs.map +1 -0
  61. package/dist/prometheus-framework/src/modules/auth/views/store/users.js +95 -0
  62. package/dist/prometheus-framework/src/modules/auth/views/store/users.js.map +1 -0
  63. package/dist/prometheus-framework/src/modules/backoffice/backoffice.client.cjs +32 -2
  64. package/dist/prometheus-framework/src/modules/backoffice/backoffice.client.cjs.map +1 -1
  65. package/dist/prometheus-framework/src/modules/backoffice/backoffice.client.js +32 -2
  66. package/dist/prometheus-framework/src/modules/backoffice/backoffice.client.js.map +1 -1
  67. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +2 -2
  68. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs.map +1 -1
  69. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +2 -2
  70. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js.map +1 -1
  71. package/dist/prometheus-framework/src/modules/chats/chats.client.cjs +31 -0
  72. package/dist/prometheus-framework/src/modules/chats/chats.client.cjs.map +1 -0
  73. package/dist/prometheus-framework/src/modules/chats/chats.client.js +31 -0
  74. package/dist/prometheus-framework/src/modules/chats/chats.client.js.map +1 -0
  75. package/dist/prometheus-framework/src/modules/community/community.client.cjs +42 -7
  76. package/dist/prometheus-framework/src/modules/community/community.client.cjs.map +1 -1
  77. package/dist/prometheus-framework/src/modules/community/community.client.js +59 -24
  78. package/dist/prometheus-framework/src/modules/community/community.client.js.map +1 -1
  79. package/dist/prometheus-framework/src/modules/community/router/blogposts.cjs +68 -70
  80. package/dist/prometheus-framework/src/modules/community/router/blogposts.cjs.map +1 -1
  81. package/dist/prometheus-framework/src/modules/community/router/blogposts.js +68 -70
  82. package/dist/prometheus-framework/src/modules/community/router/blogposts.js.map +1 -1
  83. package/dist/prometheus-framework/src/modules/gallery/gallery.client.cjs +26 -3
  84. package/dist/prometheus-framework/src/modules/gallery/gallery.client.cjs.map +1 -1
  85. package/dist/prometheus-framework/src/modules/gallery/gallery.client.js +27 -4
  86. package/dist/prometheus-framework/src/modules/gallery/gallery.client.js.map +1 -1
  87. package/dist/prometheus-framework/src/modules/gallery/router/gallery.router.cjs +2 -2
  88. package/dist/prometheus-framework/src/modules/gallery/router/gallery.router.cjs.map +1 -1
  89. package/dist/prometheus-framework/src/modules/gallery/router/gallery.router.js +2 -2
  90. package/dist/prometheus-framework/src/modules/gallery/router/gallery.router.js.map +1 -1
  91. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
  92. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
  93. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
  95. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs.map +1 -1
  97. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
  98. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js.map +1 -1
  99. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +2 -2
  100. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs.map +1 -1
  101. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
  102. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js.map +1 -1
  103. package/dist/prometheus-framework/src/modules/orders/orders.client.cjs +4 -1
  104. package/dist/prometheus-framework/src/modules/orders/orders.client.cjs.map +1 -1
  105. package/dist/prometheus-framework/src/modules/orders/orders.client.js +4 -1
  106. package/dist/prometheus-framework/src/modules/orders/orders.client.js.map +1 -1
  107. package/dist/prometheus-framework/src/modules/orders/store/testimonials.cjs +63 -0
  108. package/dist/prometheus-framework/src/modules/orders/store/testimonials.cjs.map +1 -0
  109. package/dist/prometheus-framework/src/modules/orders/store/testimonials.js +63 -0
  110. package/dist/prometheus-framework/src/modules/orders/store/testimonials.js.map +1 -0
  111. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +2 -2
  112. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
  113. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +2 -2
  114. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
  115. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  116. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs.map +1 -1
  117. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  118. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js.map +1 -1
  119. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  120. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
  121. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  122. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
  123. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  124. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +1 -1
  125. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
  126. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +1 -1
  127. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  128. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
  129. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
  130. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
  131. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
  132. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
  133. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +2 -2
  134. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs.map +1 -1
  135. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  136. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js.map +1 -1
  137. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +60 -11
  138. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs.map +1 -1
  139. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +95 -46
  140. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js.map +1 -1
  141. package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs +6 -10
  142. package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs.map +1 -1
  143. package/dist/prometheus-framework/src/modules/organizations/router/organizations.js +8 -12
  144. package/dist/prometheus-framework/src/modules/organizations/router/organizations.js.map +1 -1
  145. package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +500 -500
  146. package/dist/prometheus-framework/src/modules/pages/pages.client.js +500 -500
  147. package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.cjs +179 -0
  148. package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.cjs.map +1 -0
  149. package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.js +179 -0
  150. package/dist/prometheus-framework/src/modules/products/components/layouts/Marketplace.vue.js.map +1 -0
  151. package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.cjs +64 -0
  152. package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.cjs.map +1 -0
  153. package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.js +64 -0
  154. package/dist/prometheus-framework/src/modules/products/components/pages/Catalog.vue.js.map +1 -0
  155. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +2 -2
  156. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +2 -2
  157. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +2 -2
  158. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
  159. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +2 -2
  160. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js.map +1 -1
  161. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  162. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs.map +1 -1
  163. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  164. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js.map +1 -1
  165. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.cjs +156 -0
  166. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.cjs.map +1 -0
  167. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.js +157 -0
  168. package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.js.map +1 -0
  169. package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.cjs +1 -1
  170. package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.cjs.map +1 -1
  171. package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.js +1 -1
  172. package/dist/prometheus-framework/src/modules/products/components/sections/HeroRecommendation.vue.js.map +1 -1
  173. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
  174. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs.map +1 -1
  175. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
  176. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js.map +1 -1
  177. package/dist/prometheus-framework/src/modules/products/products.client.cjs +72 -7
  178. package/dist/prometheus-framework/src/modules/products/products.client.cjs.map +1 -1
  179. package/dist/prometheus-framework/src/modules/products/products.client.js +114 -49
  180. package/dist/prometheus-framework/src/modules/products/products.client.js.map +1 -1
  181. package/dist/prometheus-framework/src/modules/products/router/marketplace.router.cjs +46 -0
  182. package/dist/prometheus-framework/src/modules/products/router/marketplace.router.cjs.map +1 -0
  183. package/dist/prometheus-framework/src/modules/products/router/marketplace.router.js +46 -0
  184. package/dist/prometheus-framework/src/modules/products/router/marketplace.router.js.map +1 -0
  185. package/dist/prometheus-framework/src/modules/products/router/products.router.cjs +79 -36
  186. package/dist/prometheus-framework/src/modules/products/router/products.router.cjs.map +1 -1
  187. package/dist/prometheus-framework/src/modules/products/router/products.router.js +78 -35
  188. package/dist/prometheus-framework/src/modules/products/router/products.router.js.map +1 -1
  189. package/dist/prometheus-framework/src/modules/products/store/marketplace.cjs +57 -0
  190. package/dist/prometheus-framework/src/modules/products/store/marketplace.cjs.map +1 -0
  191. package/dist/prometheus-framework/src/modules/products/store/marketplace.js +57 -0
  192. package/dist/prometheus-framework/src/modules/products/store/marketplace.js.map +1 -0
  193. package/dist/prometheus-framework/src/modules/reports/reports.client.cjs +21 -2
  194. package/dist/prometheus-framework/src/modules/reports/reports.client.cjs.map +1 -1
  195. package/dist/prometheus-framework/src/modules/reports/reports.client.js +20 -1
  196. package/dist/prometheus-framework/src/modules/reports/reports.client.js.map +1 -1
  197. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  198. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs.map +1 -1
  199. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +1 -1
  200. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js.map +1 -1
  201. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +2 -2
  202. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs.map +1 -1
  203. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +2 -2
  204. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js.map +1 -1
  205. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.cjs +2 -2
  206. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.cjs.map +1 -1
  207. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.js +2 -2
  208. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.js.map +1 -1
  209. package/dist/reports.server.js +21 -8
  210. package/dist/reports.server.mjs +21 -8
  211. package/package.json +9 -1
  212. package/src/builder/webpack/webpack.config.client.js +2 -2
  213. package/src/builder/webpack/webpack.config.server.js +1 -1
  214. package/src/builder/webpack/webpack.config.spa.js +1 -1
  215. package/src/builder/webpack/webpack.config.ssr.js +1 -1
  216. package/src/modules/auth/auth.client.js +16 -3
  217. package/src/modules/auth/auth.server.js +22 -1
  218. package/src/modules/{users → auth/controllers}/routes/users.routes.js +1 -1
  219. package/src/modules/auth/controllers/services/auth.service.js +0 -1
  220. package/src/modules/{users → auth/views}/components/pages/Profile.vue +1 -1
  221. package/src/modules/{users → auth/views}/components/pages/ProfileEdit.vue +2 -2
  222. package/src/modules/{users → auth/views}/components/sections/FeaturedUsers.vue +2 -2
  223. package/src/modules/auth/views/router/users.js +79 -0
  224. package/src/modules/backoffice/backoffice.client.js +53 -11
  225. package/src/modules/backoffice/router/backoffice.js +29 -2
  226. package/src/modules/chats/chats.client.js +48 -0
  227. package/src/modules/chats/chats.server.js +32 -0
  228. package/src/modules/community/community.client.js +56 -10
  229. package/src/modules/community/community.server.js +35 -14
  230. package/src/modules/community/models/comment.model.js +7 -7
  231. package/src/modules/community/models/reaction.model.js +5 -5
  232. package/src/modules/community/router/blogposts.js +55 -57
  233. package/src/modules/events/events.server.js +37 -16
  234. package/src/modules/events/models/ticket.model.js +6 -6
  235. package/src/modules/files/files.server.js +17 -7
  236. package/src/modules/gallery/gallery.client.js +44 -8
  237. package/src/modules/gallery/gallery.server.js +28 -9
  238. package/src/modules/gallery/router/gallery.router.js +2 -2
  239. package/src/modules/orders/components/pages/OrderCreate.vue +1 -1
  240. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +1 -1
  241. package/src/modules/orders/components/sections/FormAddCustomer.vue +2 -2
  242. package/src/modules/orders/orders.client.js +4 -1
  243. package/src/modules/orders/orders.server.js +1 -0
  244. package/src/modules/organizations/components/blocks/CardDepartment.vue +1 -1
  245. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
  246. package/src/modules/organizations/components/pages/Department.vue +1 -1
  247. package/src/modules/organizations/components/pages/DepartmentEdit.vue +1 -1
  248. package/src/modules/organizations/components/pages/Members.vue +1 -1
  249. package/src/modules/organizations/components/pages/Organization.vue +1 -1
  250. package/src/modules/organizations/components/sections/MembersAdd.vue +2 -2
  251. package/src/modules/organizations/controllers/organizations.controller.js +0 -2
  252. package/src/modules/organizations/models/department.model.js +7 -7
  253. package/src/modules/organizations/models/membership.model.js +5 -5
  254. package/src/modules/organizations/organizations.client.js +71 -16
  255. package/src/modules/organizations/organizations.server.js +43 -18
  256. package/src/modules/organizations/router/organizations.js +6 -13
  257. package/src/modules/{marketplace → products}/components/layouts/Marketplace.vue +20 -19
  258. package/src/modules/{marketplace → products}/components/pages/Catalog.vue +5 -5
  259. package/src/modules/products/components/pages/Products.vue +2 -2
  260. package/src/modules/products/components/sections/FilterProducts.vue +1 -1
  261. package/src/modules/{marketplace → products}/components/sections/Filters.vue +12 -15
  262. package/src/modules/products/components/sections/HeroRecommendation.vue +1 -1
  263. package/src/modules/products/components/sections/PopularProducts.vue +1 -1
  264. package/src/modules/products/models/category.model.js +3 -3
  265. package/src/modules/products/models/product.model.js +7 -7
  266. package/src/modules/products/products.client.js +93 -25
  267. package/src/modules/products/products.server.js +47 -16
  268. package/src/modules/products/router/marketplace.router.js +38 -0
  269. package/src/modules/products/router/products.router.js +72 -32
  270. package/src/modules/reports/models/report.model.js +4 -4
  271. package/src/modules/reports/reports.client.js +35 -14
  272. package/src/modules/reports/reports.server.js +27 -8
  273. package/src/modules/spots/components/layouts/Spots.vue +1 -1
  274. package/src/modules/spots/components/pages/Map.vue +1 -1
  275. package/src/modules/spots/components/pages/Spot.vue +1 -1
  276. package/src/modules/backoffice/router/admin.js +0 -51
  277. package/src/modules/landing/components/pages/404.vue +0 -3
  278. package/src/modules/landing/components/pages/Farming.vue +0 -226
  279. package/src/modules/landing/components/pages/Governance.vue +0 -144
  280. package/src/modules/landing/components/pages/Home.vue +0 -51
  281. package/src/modules/landing/components/pages/Hotel.vue +0 -43
  282. package/src/modules/landing/router/landing.js +0 -39
  283. package/src/modules/legal/components/pages/Legal.vue +0 -62
  284. package/src/modules/legal/components/pages/legal/Cookies.vue +0 -370
  285. package/src/modules/legal/components/pages/legal/EULA.vue +0 -2145
  286. package/src/modules/legal/components/pages/legal/Privacy.vue +0 -4284
  287. package/src/modules/legal/components/pages/legal/Terms.vue +0 -1283
  288. package/src/modules/legal/legal.client.js +0 -18
  289. package/src/modules/legal/router/legal.js +0 -59
  290. package/src/modules/marketplace/router/marketplace.js +0 -54
  291. package/src/modules/users/router/users.js +0 -90
  292. package/src/modules/users/users.client.js +0 -22
  293. package/src/modules/users/users.server.js +0 -13
  294. /package/src/modules/{users → auth/controllers}/middlewares/visitor.logger.js +0 -0
  295. /package/src/modules/{users/controllers/users.controller.js → auth/controllers/services/users.service.js} +0 -0
  296. /package/src/modules/{users → auth}/models/request.model.js +0 -0
  297. /package/src/modules/{users → auth}/models/user.model.js +0 -0
  298. /package/src/modules/{users → auth}/models/visitor.model.js +0 -0
  299. /package/src/modules/{users → auth/views}/components/blocks/CardUser.vue +0 -0
  300. /package/src/modules/{users → auth/views}/components/pages/ProfileBlogposts.vue +0 -0
  301. /package/src/modules/{users → auth/views}/components/pages/ProfileComments.vue +0 -0
  302. /package/src/modules/{users → auth/views}/components/pages/ProfileLikes.vue +0 -0
  303. /package/src/modules/{users → auth/views}/components/sections/ProfileCompletion.vue +0 -0
  304. /package/src/modules/{users → auth/views}/router/account.js +0 -0
  305. /package/src/modules/{users → auth/views}/store/users.js +0 -0
  306. /package/src/modules/{projects/controller → governance/controllers/factories}/projects.controller.js +0 -0
  307. /package/src/modules/{projects → governance/controllers}/routes/projects.routes.js +0 -0
  308. /package/src/modules/{projects → governance}/models/project.model.js +0 -0
  309. /package/src/modules/{projects → governance/views}/store/projects.js +0 -0
  310. /package/src/modules/{marketplace → products}/store/marketplace.js +0 -0
@@ -1,10 +1,72 @@
1
1
  import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
2
+ import { p as profile_schema } from "./profile.schema-24ZpZQJe.mjs";
3
+ import { c as credentials_schema } from "./credentials.schema-C9dmNy7o.mjs";
2
4
  import require$$0 from "jsonwebtoken";
3
5
  import require$$1$1 from "bcryptjs";
4
6
  import require$$0$1 from "mongoose";
5
7
  import require$$1 from "jwk-to-pem";
6
8
  import { m as mailing } from "./mailing-C3VD4l0h.mjs";
7
9
  import { m as middlewares } from "./index-UIHE6Rk3.mjs";
10
+ import "uuid";
11
+ import { a as addUserStatusFields_1, b as addMembersQuantity_1 } from "./addMembersQuantity-BXp_LeQd.mjs";
12
+ import require$$0$2 from "crypto";
13
+ var socials_schema = function applySocialsSchema(schema, db) {
14
+ schema.add({
15
+ socials: {
16
+ telegram: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ twitter: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ facebook: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ instagram: {
29
+ type: String,
30
+ default: ""
31
+ }
32
+ }
33
+ });
34
+ };
35
+ const applyProfileSchema = profile_schema;
36
+ const applySocialsSchema2 = socials_schema;
37
+ const applyCredentialsSchema = credentials_schema;
38
+ var user_model = (db) => {
39
+ const UserSchema = new db.mongoose.Schema({
40
+ username: {
41
+ type: String,
42
+ unique: true
43
+ },
44
+ password: {
45
+ type: String,
46
+ required: true
47
+ },
48
+ status: {
49
+ type: String,
50
+ enum: ["active", "banned", "removed", "inactive"],
51
+ default: "active",
52
+ required: true
53
+ },
54
+ roles: [{
55
+ type: db.mongoose.Schema.Types.ObjectId,
56
+ ref: "Role"
57
+ }]
58
+ }, {
59
+ // Creation Date
60
+ timestamps: {
61
+ currentTime: () => Date.now()
62
+ }
63
+ });
64
+ applyProfileSchema(UserSchema);
65
+ applySocialsSchema2(UserSchema);
66
+ applyCredentialsSchema(UserSchema);
67
+ const User = db.mongoose.model("User", UserSchema);
68
+ return User;
69
+ };
8
70
  var role_model = (db) => {
9
71
  const RoleSchema = new db.mongoose.Schema({
10
72
  name: String
@@ -12,6 +74,31 @@ var role_model = (db) => {
12
74
  const Role = db.mongoose.model("Role", RoleSchema);
13
75
  return Role;
14
76
  };
77
+ var visitor_model = (db) => {
78
+ const VisitorSchema = new db.mongoose.Schema({
79
+ ip: String,
80
+ userAgent: String,
81
+ acceptLanguage: String,
82
+ fingerprint: { type: String, unique: true }
83
+ });
84
+ VisitorSchema.index({ fingerprint: 1 });
85
+ const Visitor = db.mongoose.model("Visitor", VisitorSchema);
86
+ return Visitor;
87
+ };
88
+ var request_model = (db) => {
89
+ const RequestSchema = new db.mongoose.Schema({
90
+ visitor: {
91
+ type: db.mongoose.Schema.Types.ObjectId,
92
+ ref: "Visitor"
93
+ },
94
+ path: String,
95
+ method: String,
96
+ timestamp: { type: Date, default: Date.now }
97
+ });
98
+ RequestSchema.index({ visitor: 1 });
99
+ const Request = db.mongoose.model("Request", RequestSchema);
100
+ return Request;
101
+ };
15
102
  const jwt$1 = require$$0;
16
103
  const jwkToPem = require$$1;
17
104
  async function verifyAppleIdToken$1(id_token) {
@@ -51,9 +138,9 @@ async function verifyAppleIdToken$1(id_token) {
51
138
  var verifyAppleIdToken_1 = { verifyAppleIdToken: verifyAppleIdToken$1 };
52
139
  const jwt = require$$0;
53
140
  const bcrypt = require$$1$1;
54
- const ObjectId = require$$0$1.Types.ObjectId;
141
+ const ObjectId$1 = require$$0$1.Types.ObjectId;
55
142
  const { verifyAppleIdToken } = verifyAppleIdToken_1;
56
- const controllerFactory$3 = (db) => {
143
+ const controllerFactory$5 = (db) => {
57
144
  const User = db.user;
58
145
  const Membership = db.membership;
59
146
  const Department = db.department;
@@ -162,8 +249,8 @@ const controllerFactory$3 = (db) => {
162
249
  await invite.save();
163
250
  const newMembership = new Membership({
164
251
  type: "organization",
165
- user: new ObjectId(user._id),
166
- target: new ObjectId(invite.owner.target),
252
+ user: new ObjectId$1(user._id),
253
+ target: new ObjectId$1(invite.owner.target),
167
254
  role: invite.role,
168
255
  label: invite.role
169
256
  });
@@ -290,9 +377,9 @@ const controllerFactory$3 = (db) => {
290
377
  checkAccesses
291
378
  };
292
379
  };
293
- var auth_service = controllerFactory$3;
380
+ var auth_service = controllerFactory$5;
294
381
  const { sendEmail, sendSms } = mailing;
295
- const controllerFactory$2 = (db) => {
382
+ const controllerFactory$4 = (db) => {
296
383
  const sendcode = async (req, res) => {
297
384
  const code = Math.floor(1e3 + Math.random() * 9e3);
298
385
  const type = req.body.type;
@@ -319,12 +406,12 @@ const controllerFactory$2 = (db) => {
319
406
  sendcode
320
407
  };
321
408
  };
322
- var twofa_service = controllerFactory$2;
323
- const controllerFactory$1 = auth_service;
409
+ var twofa_service = controllerFactory$4;
410
+ const controllerFactory$3 = auth_service;
324
411
  const controllerFactoryTwofa = twofa_service;
325
412
  const middlewareFactory$1 = middlewares;
326
413
  var auth_routes = function(app, db, origins) {
327
- const controller = controllerFactory$1(db);
414
+ const controller = controllerFactory$3(db);
328
415
  const controllerTwofa = controllerFactoryTwofa();
329
416
  const { verifySignUp, verifyUser, authJwt } = middlewareFactory$1(db);
330
417
  app.post(
@@ -358,10 +445,10 @@ var auth_routes = function(app, db, origins) {
358
445
  controller.checkAccesses
359
446
  );
360
447
  };
361
- const controllerFactory = twofa_service;
448
+ const controllerFactory$2 = twofa_service;
362
449
  const middlewareFactory = middlewares;
363
450
  var twofa_routes = function(app, db) {
364
- const controller = controllerFactory();
451
+ const controller = controllerFactory$2();
365
452
  const { verifySignUp, verifyUser } = middlewareFactory(db);
366
453
  app.post(
367
454
  "/api/twofa/sendcode",
@@ -378,30 +465,227 @@ var twofa_routes = function(app, db) {
378
465
  controller.sendcode
379
466
  );
380
467
  };
468
+ const ObjectId = require$$0$1.Types.ObjectId;
469
+ const addUserStatusFields = addUserStatusFields_1;
470
+ const addMembersQuantity = addMembersQuantity_1;
471
+ const controllerFactory$1 = (db) => {
472
+ const User = db.user;
473
+ const read = async (req, res) => {
474
+ let query = [];
475
+ let skip = parseInt(req.query.skip) || 0;
476
+ let limit = parseInt(req.query.limit) || 10;
477
+ console.log(req.query);
478
+ const matchConditions = [
479
+ ...req.query._id ? [{ _id: new ObjectId(req.query._id) }] : []
480
+ ];
481
+ let search = req.query.search;
482
+ if (search) {
483
+ let regexPattern = "";
484
+ const escapedSearch = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
485
+ if (escapedSearch.includes("@")) {
486
+ regexPattern = escapedSearch;
487
+ } else if (escapedSearch.match(/^\+?\d{0,14}$/)) {
488
+ regexPattern = escapedSearch;
489
+ } else {
490
+ regexPattern = `.*${escapedSearch}.*`;
491
+ }
492
+ matchConditions.push({
493
+ $or: [
494
+ { "profile.name": { $regex: regexPattern, $options: "i" } },
495
+ { "email": { $regex: regexPattern, $options: "i" } },
496
+ { "phone": { $regex: regexPattern, $options: "i" } },
497
+ { "username": { $regex: regexPattern, $options: "i" } }
498
+ ]
499
+ });
500
+ }
501
+ if (matchConditions.length > 0) query.push({ $match: { $and: matchConditions } });
502
+ query.push({
503
+ $lookup: {
504
+ from: "orders",
505
+ localField: "_id",
506
+ foreignField: "user",
507
+ as: "orders"
508
+ }
509
+ });
510
+ query.push({
511
+ $lookup: {
512
+ from: "roles",
513
+ localField: "roles",
514
+ foreignField: "_id",
515
+ as: "roles"
516
+ }
517
+ });
518
+ query.push({
519
+ $lookup: {
520
+ from: "memberships",
521
+ localField: "_id",
522
+ foreignField: "target",
523
+ as: "memberships"
524
+ }
525
+ });
526
+ query.push(addMembersQuantity());
527
+ if (req.query.user) query.push(addUserStatusFields(req.query.user));
528
+ query.push({
529
+ $skip: skip
530
+ });
531
+ query.push({
532
+ $limit: limit
533
+ });
534
+ try {
535
+ const users = await User.aggregate(query);
536
+ if (!users) {
537
+ return res.status(404).send({ message: "Users not found." });
538
+ }
539
+ res.status(200).send(users);
540
+ } catch (err) {
541
+ console.log(err);
542
+ res.status(500).send({ message: err });
543
+ }
544
+ };
545
+ const create = async (req, res) => {
546
+ try {
547
+ const newUser = {
548
+ phone: req.body.phone,
549
+ email: req.body.email,
550
+ roles: req.body.roles ? req.body.roles : []
551
+ };
552
+ const user = await User.create(newUser);
553
+ if (!user) {
554
+ return res.status(404).send({ errorCode: "USER_NOT_CREATED", message: "User is not created." });
555
+ }
556
+ res.status(200).send(user);
557
+ } catch (err) {
558
+ return res.status(500).send({ errorCode: "INTERNAL_SERVER_ERROR", message: err });
559
+ }
560
+ };
561
+ const update = async (req, res) => {
562
+ try {
563
+ const user = await User.findOneAndUpdate({ _id: req.params._id }, req.body, { new: true });
564
+ if (!user) {
565
+ return res.status(404).send({ errorCode: "UPDATE_FAILED", message: "Something wrong when updating user." });
566
+ }
567
+ res.status(200).send(user);
568
+ } catch (err) {
569
+ return res.status(500).send({ errorCode: "INTERNAL_SERVER_ERROR", message: err });
570
+ }
571
+ };
572
+ const remove = async (req, res) => {
573
+ try {
574
+ const user = await User.findOneAndDelete({ phone: req.params.phone });
575
+ if (!user) {
576
+ return res.status(404).send({ errorCode: "DELETION_FAILED", message: "User is not deleted." });
577
+ }
578
+ res.status(200).send(user);
579
+ } catch (err) {
580
+ return res.status(500).send({ errorCode: "INTERNAL_SERVER_ERROR", message: err });
581
+ }
582
+ };
583
+ return {
584
+ read,
585
+ create,
586
+ update,
587
+ remove
588
+ };
589
+ };
590
+ var users_service = controllerFactory$1;
591
+ const controllerFactory = users_service;
592
+ var users_routes = function(app, db, origins) {
593
+ const controller = controllerFactory(db);
594
+ app.post("/api/users", controller.create);
595
+ app.get("/api/users", controller.read);
596
+ app.put("/api/users/:_id", controller.update);
597
+ app.delete("/api/users/:_id", controller.remove);
598
+ };
599
+ const crypto = require$$0$2;
600
+ const fingerprintCache = /* @__PURE__ */ new Map();
601
+ const generateFingerprint = (req) => {
602
+ const { ip, headers } = req;
603
+ const userAgent = headers["user-agent"];
604
+ const acceptLanguage = headers["accept-language"];
605
+ const key = `${ip}-${userAgent}-${acceptLanguage}`;
606
+ if (fingerprintCache.has(key)) {
607
+ return fingerprintCache.get(key);
608
+ }
609
+ const hash = crypto.createHash("sha256");
610
+ hash.update(key);
611
+ const digest = hash.digest("hex");
612
+ fingerprintCache.set(key, digest);
613
+ return digest;
614
+ };
615
+ const modelsFactory = (db) => {
616
+ const Visitor = db.visitor;
617
+ const Request = db.request;
618
+ const visitorLogger = async (req, res, next) => {
619
+ const fingerprint = generateFingerprint(req);
620
+ try {
621
+ let visitor = await Visitor.findOne({ fingerprint });
622
+ if (!visitor) {
623
+ visitor = new Visitor({
624
+ ip: req.ip,
625
+ userAgent: req.headers["user-agent"],
626
+ acceptLanguage: req.headers["accept-language"],
627
+ fingerprint
628
+ });
629
+ await visitor.save();
630
+ }
631
+ const newRequest = new Request({
632
+ visitor: visitor._id,
633
+ path: req.path,
634
+ method: req.method,
635
+ timestamp: /* @__PURE__ */ new Date()
636
+ });
637
+ await newRequest.save();
638
+ next();
639
+ } catch (error) {
640
+ console.error("Error processing visitor and request data:", error);
641
+ next();
642
+ }
643
+ };
644
+ return {
645
+ visitorLogger
646
+ };
647
+ };
648
+ var visitor_logger = modelsFactory;
649
+ const UserModel = user_model;
381
650
  const RoleModel = role_model;
651
+ const VisitorModel = visitor_model;
652
+ const RequestModel = request_model;
382
653
  const authRoutes = auth_routes;
383
654
  const twofaRoutes = twofa_routes;
655
+ const usersRoutes = users_routes;
384
656
  const AuthController = auth_service;
385
657
  const TwoFaController = twofa_service;
658
+ const UsersController = users_service;
659
+ const visitors = visitor_logger;
386
660
  function initializeAuth(app, db, origins, publicPath) {
387
661
  db.role = RoleModel(db);
662
+ db.user = UserModel(db);
663
+ db.visitor = VisitorModel(db);
664
+ db.request = RequestModel(db);
388
665
  if (app) {
389
666
  authRoutes(app, db);
390
667
  twofaRoutes(app, db);
668
+ usersRoutes(app, db);
669
+ const visitorModule = visitors(db);
670
+ app.use(visitorModule.visitorLogger);
391
671
  }
392
672
  }
393
673
  var auth_server = {
394
674
  initialize: initializeAuth,
395
675
  models: {
396
- RoleModel
676
+ RoleModel,
677
+ UserModel,
678
+ VisitorModel
397
679
  },
398
680
  routes: {
399
681
  authRoutes,
400
- twofaRoutes
682
+ twofaRoutes,
683
+ usersRoutes
401
684
  },
402
685
  controllers: {
403
686
  AuthController,
404
- TwoFaController
687
+ TwoFaController,
688
+ UsersController
405
689
  }
406
690
  };
407
691
  const auth_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(auth_server);
package/dist/builder.js CHANGED
@@ -599,7 +599,7 @@ var webpack_config_client = (projectRoot) => {
599
599
  mode: !isProd2 ? "development" : "production",
600
600
  devtool: !isProd2 ? "inline-source-map" : "source-map",
601
601
  entry: {
602
- main: !isProd2 ? [path$3.resolve("../utils/hot-reload.js"), path$3.resolve(projectRoot, "src/index.js")] : path$3.resolve(projectRoot, "src/index.js")
602
+ main: !isProd2 ? [path$3.resolve("../utils/hot-reload.js"), path$3.resolve(projectRoot, "src/client.js")] : path$3.resolve(projectRoot, "src/client.js")
603
603
  },
604
604
  module: {
605
605
  rules: []
@@ -670,7 +670,7 @@ var webpack_config_server = (projectRoot) => {
670
670
  mode: "development",
671
671
  entry: [
672
672
  "webpack/hot/poll?1000",
673
- path$2.resolve(projectRoot, "server/server.js")
673
+ path$2.resolve(projectRoot, "src/server.js")
674
674
  ],
675
675
  output: {
676
676
  filename: "server.[fullhash].js",
@@ -707,7 +707,7 @@ var webpack_config_spa = (projectRoot) => {
707
707
  mode: !isProd ? "development" : "production",
708
708
  devtool: "source-map",
709
709
  entry: {
710
- main: path$1.resolve(projectRoot, "src/index.js")
710
+ main: path$1.resolve(projectRoot, "src/client.js")
711
711
  },
712
712
  output: {
713
713
  filename: "main.js",
@@ -768,7 +768,7 @@ var webpack_config_ssr = (projectRoot) => {
768
768
  target: "node",
769
769
  mode: !isProd2 ? "development" : "production",
770
770
  entry: {
771
- main: path.resolve(projectRoot, "src/index.js")
771
+ main: path.resolve(projectRoot, "src/client.js")
772
772
  },
773
773
  output: {
774
774
  filename: "main.[fullhash].js",
package/dist/builder.mjs CHANGED
@@ -576,7 +576,7 @@ var webpack_config_client = (projectRoot) => {
576
576
  mode: !isProd2 ? "development" : "production",
577
577
  devtool: !isProd2 ? "inline-source-map" : "source-map",
578
578
  entry: {
579
- main: !isProd2 ? [path$3.resolve("../utils/hot-reload.js"), path$3.resolve(projectRoot, "src/index.js")] : path$3.resolve(projectRoot, "src/index.js")
579
+ main: !isProd2 ? [path$3.resolve("../utils/hot-reload.js"), path$3.resolve(projectRoot, "src/client.js")] : path$3.resolve(projectRoot, "src/client.js")
580
580
  },
581
581
  module: {
582
582
  rules: []
@@ -647,7 +647,7 @@ var webpack_config_server = (projectRoot) => {
647
647
  mode: "development",
648
648
  entry: [
649
649
  "webpack/hot/poll?1000",
650
- path$2.resolve(projectRoot, "server/server.js")
650
+ path$2.resolve(projectRoot, "src/server.js")
651
651
  ],
652
652
  output: {
653
653
  filename: "server.[fullhash].js",
@@ -684,7 +684,7 @@ var webpack_config_spa = (projectRoot) => {
684
684
  mode: !isProd ? "development" : "production",
685
685
  devtool: "source-map",
686
686
  entry: {
687
- main: path$1.resolve(projectRoot, "src/index.js")
687
+ main: path$1.resolve(projectRoot, "src/client.js")
688
688
  },
689
689
  output: {
690
690
  filename: "main.js",
@@ -745,7 +745,7 @@ var webpack_config_ssr = (projectRoot) => {
745
745
  target: "node",
746
746
  mode: !isProd2 ? "development" : "production",
747
747
  entry: {
748
- main: path.resolve(projectRoot, "src/index.js")
748
+ main: path.resolve(projectRoot, "src/client.js")
749
749
  },
750
750
  output: {
751
751
  filename: "main.[fullhash].js",
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
3
+ require("./mailing-BQKyTI-q.js");
4
+ const index = require("./index-CsS7qx1d.js");
5
+ const controllerFactory$1 = (db) => {
6
+ const ChatMessage = db.ChatMessage;
7
+ const saveMessage = async (msg) => {
8
+ try {
9
+ const message = new ChatMessage(msg);
10
+ await message.save();
11
+ return message;
12
+ } catch (error) {
13
+ console.error("Error saving message to database:", error);
14
+ }
15
+ };
16
+ const getMessages = async (chatId) => {
17
+ try {
18
+ const messages = await ChatMessage.find({ chatId }).sort({ createdAt: 1 });
19
+ return messages;
20
+ } catch (error) {
21
+ console.error("Error retrieving messages from database:", error);
22
+ }
23
+ };
24
+ return {
25
+ saveMessage,
26
+ getMessages
27
+ };
28
+ };
29
+ var chats_controller = controllerFactory$1;
30
+ const controllerFactory = chats_controller;
31
+ const middlewareFactory = index.middlewares;
32
+ var chats_routes = function(app, db, wss) {
33
+ const controller = controllerFactory(db);
34
+ middlewareFactory(db);
35
+ wss.on("connection", (ws) => {
36
+ console.log("ws connecting...");
37
+ ws.on("message", async (message) => {
38
+ const msg = JSON.parse(message);
39
+ if (msg.type === "joinChat") {
40
+ ws.chatId = msg.chatId;
41
+ console.log(`Client joined chat: ${msg.chatId}`);
42
+ } else {
43
+ const savedMessage = await controller.saveMessage(msg);
44
+ wss.clients.forEach((client) => {
45
+ if (client.chatId && client.chatId.toString() === msg.chatId) {
46
+ client.send(JSON.stringify(savedMessage));
47
+ }
48
+ });
49
+ }
50
+ });
51
+ });
52
+ app.use(function(req, res, next) {
53
+ res.header(
54
+ "Access-Control-Allow-Headers",
55
+ "Access-Control-Allow-Origin: *",
56
+ "x-access-token, Origin, Content-Type, Accept"
57
+ );
58
+ next();
59
+ });
60
+ app.get("/messages/:chatId", async (req, res) => {
61
+ const { chatId } = req.params;
62
+ const messages = await controller.getMessages(chatId);
63
+ res.json(messages);
64
+ });
65
+ };
66
+ var chat_model = (db) => {
67
+ const ChatMessageSchema = new db.mongoose.Schema({
68
+ username: {
69
+ type: String,
70
+ required: true
71
+ },
72
+ chatId: {
73
+ type: String,
74
+ required: true
75
+ },
76
+ text: {
77
+ type: String,
78
+ required: true
79
+ },
80
+ createdAt: {
81
+ type: Date,
82
+ default: Date.now
83
+ }
84
+ });
85
+ const ChatMessage = db.mongoose.model("ChatMessage", ChatMessageSchema);
86
+ return ChatMessage;
87
+ };
88
+ const ChatsController = chats_controller;
89
+ const chatsRoutes = chats_routes;
90
+ const ChatModel = chat_model;
91
+ function initializeChats(app, db, wss, origins, publicPath) {
92
+ db.chat = ChatModel(db);
93
+ if (app) {
94
+ chatsRoutes(app, db, wss);
95
+ }
96
+ }
97
+ var chats_server = {
98
+ initialize: initializeChats,
99
+ models: {
100
+ ChatModel
101
+ },
102
+ routes: {
103
+ chatsRoutes
104
+ },
105
+ controllers: {
106
+ ChatsController
107
+ }
108
+ };
109
+ const chats_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(chats_server);
110
+ module.exports = chats_server$1;
@@ -0,0 +1,111 @@
1
+ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
2
+ import "./mailing-C3VD4l0h.mjs";
3
+ import { m as middlewares } from "./index-UIHE6Rk3.mjs";
4
+ const controllerFactory$1 = (db) => {
5
+ const ChatMessage = db.ChatMessage;
6
+ const saveMessage = async (msg) => {
7
+ try {
8
+ const message = new ChatMessage(msg);
9
+ await message.save();
10
+ return message;
11
+ } catch (error) {
12
+ console.error("Error saving message to database:", error);
13
+ }
14
+ };
15
+ const getMessages = async (chatId) => {
16
+ try {
17
+ const messages = await ChatMessage.find({ chatId }).sort({ createdAt: 1 });
18
+ return messages;
19
+ } catch (error) {
20
+ console.error("Error retrieving messages from database:", error);
21
+ }
22
+ };
23
+ return {
24
+ saveMessage,
25
+ getMessages
26
+ };
27
+ };
28
+ var chats_controller = controllerFactory$1;
29
+ const controllerFactory = chats_controller;
30
+ const middlewareFactory = middlewares;
31
+ var chats_routes = function(app, db, wss) {
32
+ const controller = controllerFactory(db);
33
+ middlewareFactory(db);
34
+ wss.on("connection", (ws) => {
35
+ console.log("ws connecting...");
36
+ ws.on("message", async (message) => {
37
+ const msg = JSON.parse(message);
38
+ if (msg.type === "joinChat") {
39
+ ws.chatId = msg.chatId;
40
+ console.log(`Client joined chat: ${msg.chatId}`);
41
+ } else {
42
+ const savedMessage = await controller.saveMessage(msg);
43
+ wss.clients.forEach((client) => {
44
+ if (client.chatId && client.chatId.toString() === msg.chatId) {
45
+ client.send(JSON.stringify(savedMessage));
46
+ }
47
+ });
48
+ }
49
+ });
50
+ });
51
+ app.use(function(req, res, next) {
52
+ res.header(
53
+ "Access-Control-Allow-Headers",
54
+ "Access-Control-Allow-Origin: *",
55
+ "x-access-token, Origin, Content-Type, Accept"
56
+ );
57
+ next();
58
+ });
59
+ app.get("/messages/:chatId", async (req, res) => {
60
+ const { chatId } = req.params;
61
+ const messages = await controller.getMessages(chatId);
62
+ res.json(messages);
63
+ });
64
+ };
65
+ var chat_model = (db) => {
66
+ const ChatMessageSchema = new db.mongoose.Schema({
67
+ username: {
68
+ type: String,
69
+ required: true
70
+ },
71
+ chatId: {
72
+ type: String,
73
+ required: true
74
+ },
75
+ text: {
76
+ type: String,
77
+ required: true
78
+ },
79
+ createdAt: {
80
+ type: Date,
81
+ default: Date.now
82
+ }
83
+ });
84
+ const ChatMessage = db.mongoose.model("ChatMessage", ChatMessageSchema);
85
+ return ChatMessage;
86
+ };
87
+ const ChatsController = chats_controller;
88
+ const chatsRoutes = chats_routes;
89
+ const ChatModel = chat_model;
90
+ function initializeChats(app, db, wss, origins, publicPath) {
91
+ db.chat = ChatModel(db);
92
+ if (app) {
93
+ chatsRoutes(app, db, wss);
94
+ }
95
+ }
96
+ var chats_server = {
97
+ initialize: initializeChats,
98
+ models: {
99
+ ChatModel
100
+ },
101
+ routes: {
102
+ chatsRoutes
103
+ },
104
+ controllers: {
105
+ ChatsController
106
+ }
107
+ };
108
+ const chats_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(chats_server);
109
+ export {
110
+ chats_server$1 as default
111
+ };