@ozdao/prometheus-framework 0.2.137 → 0.2.139

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. package/dist/auth.server.js +29 -14
  2. package/dist/auth.server.mjs +29 -14
  3. package/dist/community.server.js +3 -3
  4. package/dist/community.server.mjs +3 -3
  5. package/dist/events.server.js +3 -3
  6. package/dist/events.server.mjs +3 -3
  7. package/dist/files.server.js +3 -3
  8. package/dist/files.server.mjs +3 -3
  9. package/dist/gallery.server.js +4 -4
  10. package/dist/gallery.server.mjs +4 -4
  11. package/dist/index-DNI4aUP2.js +259 -0
  12. package/dist/index-Tcyehi73.mjs +260 -0
  13. package/dist/main-DTHFR7H_.mjs +14510 -0
  14. package/dist/main-wXdocsbd.js +92 -0
  15. package/dist/main.css +1 -1
  16. package/dist/orders.server.js +9 -8
  17. package/dist/orders.server.mjs +9 -8
  18. package/dist/organizations.server.js +32 -17
  19. package/dist/organizations.server.mjs +32 -17
  20. package/dist/products.server.js +37 -5
  21. package/dist/products.server.mjs +37 -5
  22. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  23. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  24. package/dist/prometheus-framework/src/components/Completion/Completion.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/components/Completion/Completion.vue.js +19 -19
  26. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +1 -1
  28. package/dist/prometheus-framework/src/components/Map/Map.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/Map/Map.vue.js +3 -2
  30. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +32 -31
  32. package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
  33. package/dist/prometheus-framework/src/modules/auth/store/auth.js +50 -47
  34. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
  36. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  37. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  38. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
  40. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
  42. package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.cjs +1 -1
  43. package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.js +1 -1
  44. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +12 -12
  46. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
  48. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +41 -38
  50. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +123 -114
  52. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +51 -52
  54. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  56. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +16 -15
  58. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +120 -60
  60. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
  62. package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/organizations/store/invites.js +25 -24
  64. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +7 -7
  66. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +3 -3
  68. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +65 -66
  70. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +81 -76
  72. package/dist/prometheus-framework/src/modules/spots/router/spots.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/spots/router/spots.js +1 -1
  74. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  76. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +78 -74
  78. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
  80. package/dist/prometheus-framework.cjs.js +1 -1
  81. package/dist/prometheus-framework.es.js +1 -1
  82. package/dist/reports.server.js +0 -3
  83. package/dist/reports.server.mjs +0 -3
  84. package/dist/spots.server.js +3 -3
  85. package/dist/spots.server.mjs +3 -3
  86. package/dist/style.css +1 -1
  87. package/dist/wallet.server.js +5 -5
  88. package/dist/wallet.server.mjs +8 -8
  89. package/dist/web-Dh669DqQ.mjs +54 -0
  90. package/dist/web-Dt2RCU54.js +1 -0
  91. package/package.json +1 -1
  92. package/src/components/Completion/Completion.vue +29 -30
  93. package/src/components/Map/Map.vue +2 -2
  94. package/src/modules/auth/components/pages/Invite.vue +4 -2
  95. package/src/modules/auth/controllers/auth.controller.js +30 -12
  96. package/src/modules/auth/middlewares/authJwt.js +80 -0
  97. package/src/modules/{middlewares/server → auth/middlewares}/index.js +1 -3
  98. package/src/modules/{middlewares/server → auth/middlewares}/verifyAccesses.js +1 -1
  99. package/src/modules/auth/routes/auth.routes.js +2 -2
  100. package/src/modules/auth/routes/twofa.routes.js +1 -1
  101. package/src/modules/auth/store/auth.js +9 -0
  102. package/src/modules/chats/routes/chats.routes.js +1 -1
  103. package/src/modules/community/routes/blog.routes.js +2 -2
  104. package/src/modules/events/routes/events.routes.js +2 -2
  105. package/src/modules/files/routes/files.routes.js +2 -2
  106. package/src/modules/gallery/routes/gallery.routes.js +4 -5
  107. package/src/modules/globals/services/globals.crud.js +2 -2
  108. package/src/modules/marketplace/store/marketplace.js +1 -1
  109. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +2 -2
  110. package/src/modules/orders/components/sections/FormAddCustomer.vue +2 -2
  111. package/src/modules/orders/controllers/orders.controller.js +1 -0
  112. package/src/modules/orders/routes/applications.routes.js +2 -2
  113. package/src/modules/orders/routes/orders.routes.js +2 -2
  114. package/src/modules/organizations/components/blocks/CardOrganization.vue +9 -7
  115. package/src/modules/organizations/components/pages/Members.vue +26 -15
  116. package/src/modules/organizations/components/pages/Organization.vue +3 -3
  117. package/src/modules/organizations/components/sections/DetailsTab.vue +1 -1
  118. package/src/modules/organizations/components/sections/MembersAdd.vue +101 -43
  119. package/src/modules/organizations/controllers/invites.controller.js +18 -13
  120. package/src/modules/organizations/controllers/memberships.controller.js +18 -11
  121. package/src/modules/organizations/controllers/organizations.controller.js +3 -4
  122. package/src/modules/organizations/models/membership.model.js +2 -0
  123. package/src/modules/organizations/models/organization.model.js +4 -0
  124. package/src/modules/organizations/routes/invites.routes.js +2 -2
  125. package/src/modules/organizations/store/invites.js +2 -1
  126. package/src/modules/products/controllers/leftovers.controller.js +1 -1
  127. package/src/modules/products/middlewares/index.js +11 -0
  128. package/src/modules/products/routes/categories.routes.js +2 -2
  129. package/src/modules/reports/routes/reports.routes.js +2 -2
  130. package/src/modules/spots/components/blocks/CardSpot.vue +0 -1
  131. package/src/modules/spots/components/layouts/Spots.vue +2 -2
  132. package/src/modules/spots/components/pages/Map.vue +79 -78
  133. package/src/modules/spots/components/pages/SpotEdit.vue +8 -5
  134. package/src/modules/spots/controllers/spots.controller.js +1 -5
  135. package/src/modules/spots/router/spots.js +1 -1
  136. package/src/modules/users/components/pages/ProfileEdit.vue +37 -22
  137. package/src/modules/wallet/controllers/routes/payments.routes.js +2 -2
  138. package/src/modules/wallet/controllers/routes/rewards.routes.js +2 -2
  139. package/src/modules/middlewares/server/authJwt.js +0 -68
  140. /package/src/modules/{middlewares/server → auth/middlewares}/authSecret.js +0 -0
  141. /package/src/modules/{middlewares/server → auth/middlewares}/verifyInvites.js +0 -0
  142. /package/src/modules/{middlewares/server → auth/middlewares}/verifySignUp.js +0 -0
  143. /package/src/modules/{middlewares/server → auth/middlewares}/verifyUser.js +0 -0
  144. /package/src/modules/globals/services/{globals.cashe.js → globals.cache.js} +0 -0
  145. /package/src/modules/{middlewares/server → products/middlewares}/verifyCategory.js +0 -0
@@ -1,48 +1,97 @@
1
1
  <template>
2
2
  <div>
3
3
  <p class="mn-b-thin t-transp p-medium">{{text}}</p>
4
- <section class="cols-1 mn-b-small radius-medium pd-semi bg-light">
5
- <div
6
- v-for="(member, index) in members"
7
- :key="index"
8
- class="
9
- br-1px br-solid br-grey-transp-25
10
- flex
11
- gap-thin
12
- radius-small
13
- mn-b-thin
14
- "
4
+
5
+ <div class="mn-b-thin pos-relative">
6
+ <BlockSearch
7
+ v-click-outside="() => {searchUserShow = false}"
8
+ @search="(event) => { searchUser = event; searchUserShow = true }"
9
+ placeholder="Enter name, phone or email"
10
+ class="bg-grey"
11
+ />
12
+
13
+ <div
14
+ v-if="searchUser && searchUserShow"
15
+ class="mn-t-thin pos-absolute w-100 pos-t-100 pos-l-0 z-index-3 bg-light pd-small radius-small
16
+ ">
17
+ <Feed
18
+ :states="{
19
+ empty: {
20
+ title: 'No User Found',
21
+ description: 'Currently, there are no such user.'
22
+ }
23
+ }"
24
+ :store="{
25
+ read: (options) => users.actions.read(options),
26
+ state: null
27
+ }"
28
+ :options="{
29
+ search: searchUser
30
+ }"
31
+ :showLoadMore="false"
32
+ v-slot="{
33
+ items
34
+ }"
35
+ class="h-max-20r o-scroll"
36
+ >
37
+ <CardUser
38
+ v-for="(user, index) in items" :key="user._id"
39
+ :user="user"
40
+ :photo="user.profile.photo"
41
+ :name="user.profile.name || user.phone || user.email"
42
+ @click="() => {
43
+ members.push({contact: user.email || user.phone})
44
+ searchUserShow = false
45
+ }"
46
+ class="bg-white h-2r pd-thin radius-medium w-100 mn-b-thin"
47
+ />
48
+ </Feed>
49
+ </div>
50
+ </div>
51
+
52
+ <section class="cols-1 mn-b-small radius-medium pd-semi bg-light pos-relative">
53
+
54
+ <div
55
+ v-for="(member, index) in members"
56
+ :key="index"
57
+ class="
58
+ br-1px br-solid br-grey-transp-25
59
+ flex
60
+ gap-thin
61
+ radius-small
62
+ mn-b-thin
63
+ "
64
+ >
65
+ <Field
66
+ v-model:field="member.contact"
67
+ placeholder="Enter email or phone"
68
+ class="w-100 pd-small radius-small bg-white"
69
+ :validation="contactValidation"
15
70
  >
16
- <Field
17
- v-model:field="member.contact"
18
- placeholder="Enter email or phone"
19
- class="w-100 pd-small radius-small bg-white"
20
- :validation="contactValidation"
71
+ <div
72
+ v-if="index < 1"
73
+ @click="() => members.push({contact: ''})"
74
+ class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-green"
21
75
  >
22
- <div
23
- v-if="index < 1"
24
- @click="() => members.push({contact: ''})"
25
- class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-green"
26
- >
27
- <IconAdd
28
- class="i-medium"
29
- :fill="'rgb(var(--white)'"
30
- />
31
- </div>
76
+ <IconAdd
77
+ class="i-medium"
78
+ :fill="'rgb(var(--white)'"
79
+ />
80
+ </div>
32
81
 
33
- <div
34
- v-else
35
- @click="() => members.splice(index, 1)"
36
- class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-red"
37
- >
38
- <IconDelete
39
- class="i-medium"
40
- :fill="'rgb(var(--white)'"
41
- />
42
- </div>
43
- </Field>
44
- </div>
45
- </section>
82
+ <div
83
+ v-else
84
+ @click="() => members.splice(index, 1)"
85
+ class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-red"
86
+ >
87
+ <IconDelete
88
+ class="i-medium"
89
+ :fill="'rgb(var(--white)'"
90
+ />
91
+ </div>
92
+ </Field>
93
+ </div>
94
+ </section>
46
95
 
47
96
 
48
97
  <Button
@@ -59,19 +108,26 @@
59
108
  import Field from '@pf/src/components/Field/Field.vue'
60
109
  import Select from '@pf/src/components/Select/Select.vue'
61
110
  import Button from '@pf/src/components/Button/Button.vue'
111
+ import Feed from '@pf/src/components/Feed/Feed.vue'
112
+
113
+ import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
114
+
115
+ import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
62
116
 
63
117
  import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';
64
118
  import IconAdd from '@pf/src/modules/icons/navigation/IconAdd.vue';
65
119
  // Import validation
66
120
  import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
67
-
68
- import * as invites from '@pf/src/modules/organizations/store/invites';
121
+ // Store
122
+ import * as users from '@pf/src/modules/users/store/users';
69
123
  // Props
70
124
  const props = defineProps({
71
125
  organization: Object,
72
126
  text: String,
73
127
  });
74
-
128
+ // User Search
129
+ let searchUser = ref(null)
130
+ let searchUserShow = ref(false)
75
131
  // Validation
76
132
  const contactValidation = ref(null)
77
133
  // Define Emits
@@ -80,6 +136,8 @@
80
136
  const members = ref([{ contact: ''}]);
81
137
 
82
138
  async function submitMembers() {
83
- emits('send-invite', members.value);
139
+ return new Promise((resolve, reject) => {
140
+ emits('send-invite', members.value, resolve, reject);
141
+ });
84
142
  }
85
143
  </script>
@@ -34,15 +34,20 @@ const сontrollerFactory = (db) => {
34
34
  };
35
35
 
36
36
  const create = async (req, res) => {
37
- const creator = req.body.creator
38
- const owner = req.body.owner
39
-
40
- const list = req.body.invites
37
+ const creator = req.body.creator;
38
+ const owner = req.body.owner;
39
+ const list = req.body.invites;
40
+ const createdInvites = [];
41
+ const createdMemberships = [];
41
42
 
42
43
  try {
43
44
  for (let invite of list) {
44
45
  let user = null;
45
46
 
47
+ if (!invite || !invite.contact) {
48
+ continue; // Пропускаем пустые объекты или объекты без contact
49
+ }
50
+
46
51
  if (invite.contact.includes('@')) {
47
52
  user = await User.findOne({ email: invite.contact });
48
53
  } else {
@@ -50,7 +55,6 @@ const сontrollerFactory = (db) => {
50
55
  }
51
56
 
52
57
  if (user) {
53
-
54
58
  const membership = new Membership({
55
59
  user: user._id,
56
60
  type: 'organization',
@@ -58,10 +62,9 @@ const сontrollerFactory = (db) => {
58
62
  role: 'member',
59
63
  label: 'member'
60
64
  });
61
-
62
- await membership.save();
65
+ const savedMembership = await membership.save();
66
+ createdMemberships.push(savedMembership);
63
67
  } else {
64
-
65
68
  const newInvite = new Invite({
66
69
  code: uuid(),
67
70
  creator: creator,
@@ -70,26 +73,28 @@ const сontrollerFactory = (db) => {
70
73
  email: invite.contact.includes('@') ? invite.contact : null,
71
74
  phone: !invite.contact.includes('@') ? invite.contact : null,
72
75
  });
73
-
74
76
  const savedInvite = await newInvite.save();
77
+ createdInvites.push(savedInvite);
75
78
 
76
79
  if (savedInvite.email !== null) {
77
80
  const to = savedInvite.email;
78
81
  const subject = 'You have been added to the organization';
79
- const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email"`;
82
+ const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email`;
80
83
 
81
84
  await sendEmail(to, subject, text);
82
85
  }
83
-
84
86
  if (savedInvite.phone !== null) {
85
87
  const phone = savedInvite.phone;
86
88
  const message = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=phone`;
87
-
88
89
  await sendSms(phone, message);
89
90
  }
90
91
  }
91
92
  }
92
- res.status(200).json({ message: 'Invites sent successfully!' });
93
+ res.status(200).json({
94
+ message: 'Invites sent successfully!',
95
+ createdInvites: createdInvites,
96
+ createdMemberships: createdMemberships
97
+ });
93
98
  } catch (error) {
94
99
  console.error(error);
95
100
  res.status(500).json({ message: 'Something went wrong' });
@@ -4,6 +4,7 @@ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils
4
4
 
5
5
  const controllerFactory = (db) => {
6
6
  const Membership = db.membership;
7
+ const Department = db.department;
7
8
 
8
9
  const read = async (req, res) => {
9
10
  try {
@@ -66,10 +67,10 @@ const controllerFactory = (db) => {
66
67
  )
67
68
  ]);
68
69
 
69
- if (!memberships || memberships.length === 0) {
70
+ if (!memberships) {
70
71
  return res.status(404).send({ errorCode: 'MEMBERSHIPS_NOT_FOUND' });
71
72
  }
72
- console.log('membership is', memberships[0].user)
73
+
73
74
  res.send(memberships);
74
75
  } catch (err) {
75
76
  console.log(err);
@@ -109,21 +110,27 @@ const controllerFactory = (db) => {
109
110
  const deleteMembership = async (req, res) => {
110
111
  const { _id, type, target, user, role } = req.body;
111
112
 
112
-
113
- console.log(req.body)
114
-
115
113
  try {
116
- // const membership = await Membership.findOne({ type, target, user, role });
117
- const membership = _id ? await Membership.findOneAndDelete({ _id: new ObjectId(req.body._id)}) : await Membership.findOne({ type, target, user, role })
114
+ // Обрабатываем сценарий когда мы не знаем _id нашего membership
115
+ const membership = _id
116
+ ? await Membership.findOneAndDelete({ _id: new ObjectId(_id) })
117
+ : await Membership.findOneAndDelete({ type, target, user, role });
118
118
 
119
119
  if (!membership) {
120
120
  return res.status(404).send({ errorCode: 'MEMBERSHIP_NOT_FOUND' });
121
- } else {
122
- await Membership.deleteOne({ _id: membership._id });
123
- res.status(200).send(membership);
124
121
  }
122
+
123
+ // Удаление пользователя из departments
124
+ if (membership.type === 'organization') {
125
+ await Department.updateMany(
126
+ { organization: target },
127
+ { $pull: { members: { user: user } } }
128
+ );
129
+ }
130
+
131
+ res.status(200).send(membership);
125
132
  } catch (error) {
126
- console.log(error)
133
+ console.log(error);
127
134
  res.status(500).send({ errorCode: 'SERVER_ERROR' });
128
135
  }
129
136
  };
@@ -27,7 +27,6 @@ const controllerFactory = (db) => {
27
27
  const sort = {
28
28
  ...(sortParam === 'distance' ? { 'distanceExist': -1 } : {}),
29
29
  [sortParam]: sortOrder === 'desc' ? -1 : 1,
30
- 'numberOfProducts': -1,
31
30
  "_id": 1
32
31
  };
33
32
  console.log(sort)
@@ -140,7 +139,7 @@ const controllerFactory = (db) => {
140
139
  }
141
140
 
142
141
  // Determine the search radius based on the level of specificity
143
- const radius = city ? 500 : state ? 1000 : 5000;
142
+ const radius = city ? 25 : state ? 50 : 250;
144
143
 
145
144
  // Use MongoDB's $geoNear to find organizations within a certain radius
146
145
  matchConditions.push({
@@ -185,9 +184,9 @@ const controllerFactory = (db) => {
185
184
  if (locationRadius) {
186
185
  radius = parseFloat(locationRadius) / earthRadiusKm;
187
186
  } else if (city) {
188
- radius = 500 / earthRadiusKm;
187
+ radius = 25 / earthRadiusKm;
189
188
  } else if (state) {
190
- radius = 1000 / earthRadiusKm;
189
+ radius = 50 / earthRadiusKm;
191
190
  } else {
192
191
  radius = null
193
192
  }
@@ -31,6 +31,8 @@ module.exports = (mongoose) => {
31
31
  timestamps: true
32
32
  });
33
33
 
34
+ MembershipSchema.index({ user: 1, target: 1});
35
+
34
36
  const Membership = mongoose.model('Membership', MembershipSchema);
35
37
 
36
38
  return Membership;
@@ -67,6 +67,10 @@ module.exports = (db) => {
67
67
  });
68
68
 
69
69
  applyEngagementSchema(OrganizationSchema,db);
70
+
71
+
72
+ OrganizationSchema.index({ _id: 1, owner: 1 });
73
+
70
74
 
71
75
  // const Testimonial = require('./testimonial.model');
72
76
 
@@ -1,11 +1,11 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/invites.controller");
3
3
  // Middlewares
4
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
5
  // Routes
6
6
  module.exports = function(app, db) {
7
7
  const controller = controllerFactory(db);
8
- const { verifyInvites } = middlewareFactory(db);
8
+ const { verifyInvites } = middlewareFactoryAuth(db);
9
9
 
10
10
  // Get one invite
11
11
  app.get(
@@ -38,7 +38,8 @@ const actions = {
38
38
  },
39
39
  async create(invites) {
40
40
  try {
41
- await $axios.post(`/api/invites/create`, invites);
41
+ const response = await $axios.post(`/api/invites/create`, invites);
42
+ return Promise.resolve(response.data);
42
43
  state.error = null;
43
44
  } catch (error) {
44
45
  setError(error);
@@ -59,7 +59,7 @@ const controllerFactory = (db) => {
59
59
 
60
60
  const leftoveres = await Leftover.aggregate(stages).exec();
61
61
 
62
- if (!leftoveres.length) {
62
+ if (!leftoveres) {
63
63
  return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
64
64
  }
65
65
 
@@ -0,0 +1,11 @@
1
+ // middlewareIndexFactory.js
2
+
3
+ const middlewareIndexFactory = (db) => {
4
+ const verifyCategory = require("./verifyCategory")(db);
5
+
6
+ return {
7
+ verifyCategory
8
+ };
9
+ };
10
+
11
+ module.exports = middlewareIndexFactory;
@@ -1,12 +1,12 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/categories.controller");
3
3
  // Middlewares
4
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryProducts = require('@pf/src/modules/products/middlewares');
5
5
 
6
6
  module.exports = function(app, db) {
7
7
  const controller = controllerFactory(db);
8
8
 
9
- const { verifyCategory } = middlewareFactory(db);
9
+ const { verifyCategory } = middlewareFactoryProducts(db);
10
10
  // Get categorys
11
11
  app.get(
12
12
  "/categories",
@@ -1,11 +1,11 @@
1
1
  const controllerFactory = require("../controllers/reports.controller");
2
2
  // Middlewares
3
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
3
+ // const middlewareFactoryGlobal = require('@pf/src/modules/middlewares');
4
4
 
5
5
  module.exports = function(app, db, origins) {
6
6
  const controller = controllerFactory(db);
7
7
 
8
- const { authJwt } = middlewareFactoryGlobal(db);
8
+ // const { authJwt } = middlewareFactoryGlobal(db);
9
9
 
10
10
  app.get(
11
11
  "/reports",
@@ -25,7 +25,6 @@
25
25
  />
26
26
 
27
27
 
28
-
29
28
  <p
30
29
  @click="$router.push(`/app/organization/${props.organization._id}/spots/${spot._id}`)"
31
30
  class="pd-thin bg-white radius-small mn-b-thin p-small w-max"
@@ -101,7 +101,7 @@
101
101
  delivery: query.delivery ? query.delivery.split(',') : [],
102
102
  // Продолжайте этот паттерн для остальных полей фильтра
103
103
  };
104
- marketplace.state.filter = newFilterValue;
104
+ marketplace.state.filter.selected = newFilterValue;
105
105
  }
106
106
 
107
107
 
@@ -109,7 +109,7 @@
109
109
  await categories.actions.fetchCategories()
110
110
  })
111
111
 
112
- watch(() => marketplace.state.filter, (newFilterValue, oldFilterValue) => {
112
+ watch(() => marketplace.state.filter.selected, (newFilterValue, oldFilterValue) => {
113
113
  // Переводим фильтр в формат query
114
114
  const query = { ...route.query };
115
115
 
@@ -89,106 +89,107 @@ onMounted(async () => {
89
89
 
90
90
  // Определите уровень зума в зависимости от доступной информации
91
91
  if (route.params.location || globals.state.position?.location) {
92
- zoomLevel = 12;
92
+ zoomLevel = 15;
93
93
  } else if (route.params.country || globals.state.position?.country) {
94
94
  zoomLevel = 9;
95
95
  } else if (route.params.state || globals.state.position?.state) {
96
96
  zoomLevel = 6;
97
97
  } else if (route.params.city || globals.state.position?.city) {
98
- zoomLevel = 4;
98
+ zoomLevel = 14;
99
99
  } else {
100
100
  zoomLevel = 2;
101
101
  }
102
102
 
103
- // Если координаты не заданы, попробуйте их получить
104
- if (!lat || !lng) {
105
- let country
106
-
107
- const geocoder = new google.maps.Geocoder();
103
+ const loader = new GMLoader({
104
+ apiKey: props.apiKey,
105
+ version: "weekly",
106
+ libraries: ["places"],
107
+ language: 'en'
108
+ });
108
109
 
109
- try {
110
- country = await getCountry();
111
- } catch {
112
- country = 'Thailand'
113
- console.log(error)
114
- }
110
+ loader.load().then(async () => {
115
111
 
116
- try {
117
- const results = await geocoder.geocode({ 'address': country })
112
+ // Если координаты не заданы, попробуйте их получить
113
+ if (!lat || !lng) {
114
+ let country
118
115
 
119
- console.log(results);
116
+ const geocoder = new google.maps.Geocoder();
120
117
 
121
- if (results) {
122
- lat = results.results[0].geometry.location.lat();
123
- lng = results.results[0].geometry.location.lng();
124
- zoomLevel = 6;
125
- } else {
126
- console.error('No results found for the country code.');
127
- }
128
- } catch (error) {
129
- console.error('Error getting coordinates from country code:', error);
130
- }
131
- }
132
-
133
- // If there's no lat/lng in the query, try to use country/state/city to get the lat/lng
134
- if (!lat && !lng && (route.params.country || route.params.state || route.params.city)) {
135
- const geocoder = new google.maps.Geocoder();
136
-
137
- const address = [
138
- route.params.city,
139
- route.params.state,
140
- route.params.country
141
- ].filter(Boolean).join(', ');
142
-
143
- try {
144
- const results = await geocoder.geocode({ address });
145
-
146
- if (results[0]) {
147
- lat = results[0].geometry.location.lat();
148
- lng = results[0].geometry.location.lng();
118
+ try {
119
+ country = await getCountry();
120
+ } catch {
121
+ country = 'Thailand'
122
+ console.log(error)
149
123
  }
150
124
 
151
- } catch (error) {
152
- console.error('Error getting coordinates:', error);
153
- }
154
- }
125
+ try {
126
+ const results = await geocoder.geocode({ 'address': country })
155
127
 
156
- const loader = new GMLoader({
157
- apiKey: props.apiKey,
158
- version: "weekly",
159
- libraries: ["places"],
160
- language: 'en'
161
- });
128
+ console.log(results);
162
129
 
163
- skip.value += limit.value;
130
+ if (results) {
131
+ lat = results.results[0].geometry.location.lat();
132
+ lng = results.results[0].geometry.location.lng();
133
+ zoomLevel = 6;
134
+ } else {
135
+ console.error('No results found for the country code.');
136
+ }
137
+ } catch (error) {
138
+ console.error('Error getting coordinates from country code:', error);
139
+ }
140
+ }
141
+
142
+ // If there's no lat/lng in the query, try to use country/state/city to get the lat/lng
143
+ if (!lat && !lng && (route.params.country || route.params.state || route.params.city)) {
144
+ const geocoder = new google.maps.Geocoder();
145
+
146
+ const address = [
147
+ route.params.city,
148
+ route.params.state,
149
+ route.params.country
150
+ ].filter(Boolean).join(', ');
151
+
152
+ try {
153
+ const results = await geocoder.geocode({ address });
154
+
155
+ if (results[0]) {
156
+ lat = results[0].geometry.location.lat();
157
+ lng = results[0].geometry.location.lng();
158
+ }
164
159
 
165
- const params = {
166
- // country: route.params.country,
167
- // state: route.params.state,
168
- // city: route.params.city,
169
- // categories: route.query.categories,
170
- // prices: route.query.prices,
171
- // delivery: route.query.delivery,
172
- country: route.params.country,
173
- state: route.params.state,
174
- city: route.params.city,
175
- categories: route.query.categories,
176
- prices: route.query.prices,
177
- delivery: route.query.delivery,
178
- sortParam: route.query.sortParam || marketplace.state.sort.param,
179
- sortOrder: route.query.sortOrder || marketplace.state.sort.order,
180
- location: {coordinates: [lng,lat] },
181
- locationRadius: 1000,
182
- limit: 500,
183
- };
160
+ } catch (error) {
161
+ console.error('Error getting coordinates:', error);
162
+ }
163
+ }
184
164
 
185
- console.log(params)
186
165
 
187
- const data = await actions.read(params);
166
+ skip.value += limit.value;
167
+
168
+ const params = {
169
+ // country: route.params.country,
170
+ // state: route.params.state,
171
+ // city: route.params.city,
172
+ // categories: route.query.categories,
173
+ // prices: route.query.prices,
174
+ // delivery: route.query.delivery,
175
+ country: route.params.country,
176
+ state: route.params.state,
177
+ city: route.params.city,
178
+ categories: route.query.categories,
179
+ prices: route.query.prices,
180
+ delivery: route.query.delivery,
181
+ sortParam: route.query.sortParam || marketplace.state.sort.param,
182
+ sortOrder: route.query.sortOrder || marketplace.state.sort.order,
183
+ location: {coordinates: [lng,lat] },
184
+ locationRadius: 1000,
185
+ limit: 500,
186
+ };
187
+
188
+ console.log(params)
188
189
 
189
- state.all = [...state.all, ...data];
190
+ const data = await actions.read(params);
190
191
 
191
- loader.load().then(() => {
192
+ state.all = [...state.all, ...data];
192
193
 
193
194
  map.value = new google.maps.Map(document.getElementById('map'), {
194
195
  mapTypeControl: false,