@shophost/rest-api 2.0.34 → 2.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/LICENSE +17 -13
  2. package/README.md +76 -66
  3. package/package.json +2 -2
  4. package/scripts/minify-dist.mjs +45 -0
  5. package/src/app.js +1 -53
  6. package/src/app.js.map +1 -1
  7. package/src/core/auth/auth.schema.js +1 -41
  8. package/src/core/auth/auth.util.js +1 -44
  9. package/src/core/auth/better-auth.lib.js +1 -100
  10. package/src/core/auth/generate-password-hash.util.js +1 -30
  11. package/src/core/auth/headers.schema.js +1 -22
  12. package/src/core/auth/user.schema.js +1 -30
  13. package/src/core/db/__generated__/client/browser.js +1 -18
  14. package/src/core/db/__generated__/client/client.js +1 -35
  15. package/src/core/db/__generated__/client/commonInputTypes.js +1 -11
  16. package/src/core/db/__generated__/client/enums.js +1 -200
  17. package/src/core/db/__generated__/client/internal/class.js +769 -55
  18. package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +2 -2
  19. package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
  20. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
  21. package/src/core/db/__generated__/client/models/Account.d.ts +0 -5
  22. package/src/core/db/__generated__/client/models/Account.js +1 -2
  23. package/src/core/db/__generated__/client/models/Address.d.ts +0 -5
  24. package/src/core/db/__generated__/client/models/Address.js +1 -2
  25. package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -5
  26. package/src/core/db/__generated__/client/models/Campaign.js +1 -2
  27. package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -5
  28. package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
  29. package/src/core/db/__generated__/client/models/File.d.ts +0 -5
  30. package/src/core/db/__generated__/client/models/File.js +1 -2
  31. package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -5
  32. package/src/core/db/__generated__/client/models/Invitation.js +1 -2
  33. package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -5
  34. package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
  35. package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -5
  36. package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
  37. package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -5
  38. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
  39. package/src/core/db/__generated__/client/models/Member.d.ts +0 -5
  40. package/src/core/db/__generated__/client/models/Member.js +1 -2
  41. package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -5
  42. package/src/core/db/__generated__/client/models/Modifier.js +1 -2
  43. package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -5
  44. package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
  45. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -5
  46. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
  47. package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -5
  48. package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
  49. package/src/core/db/__generated__/client/models/Order.d.ts +0 -5
  50. package/src/core/db/__generated__/client/models/Order.js +1 -2
  51. package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -5
  52. package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
  53. package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -5
  54. package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
  55. package/src/core/db/__generated__/client/models/Organization.d.ts +0 -5
  56. package/src/core/db/__generated__/client/models/Organization.js +1 -2
  57. package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -5
  58. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
  59. package/src/core/db/__generated__/client/models/Payment.d.ts +0 -5
  60. package/src/core/db/__generated__/client/models/Payment.js +1 -2
  61. package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -5
  62. package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
  63. package/src/core/db/__generated__/client/models/Product.d.ts +0 -5
  64. package/src/core/db/__generated__/client/models/Product.js +1 -2
  65. package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -5
  66. package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
  67. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -5
  68. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
  69. package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -5
  70. package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
  71. package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -5
  72. package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
  73. package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -5
  74. package/src/core/db/__generated__/client/models/Reservation.js +1 -2
  75. package/src/core/db/__generated__/client/models/Session.d.ts +0 -5
  76. package/src/core/db/__generated__/client/models/Session.js +1 -2
  77. package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -5
  78. package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
  79. package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -5
  80. package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
  81. package/src/core/db/__generated__/client/models/User.d.ts +0 -5
  82. package/src/core/db/__generated__/client/models/User.js +1 -2
  83. package/src/core/db/__generated__/client/models/Verification.d.ts +0 -5
  84. package/src/core/db/__generated__/client/models/Verification.js +1 -2
  85. package/src/core/db/__generated__/client/models.js +1 -2
  86. package/src/core/db/index.js +1 -2
  87. package/src/core/email/components.d.ts +16 -0
  88. package/src/core/email/components.js +1 -0
  89. package/src/core/email/components.js.map +1 -0
  90. package/src/core/exceptions/http-exception.js +1 -9
  91. package/src/core/hono/hono.js +1 -123
  92. package/src/core/lib/prisma.d.ts +8 -8
  93. package/src/core/lib/prisma.js +1 -11
  94. package/src/core/logging/pino.js +1 -5
  95. package/src/core/notifications/email.service.js +1 -116
  96. package/src/core/openapi/openapi.lib.js +1 -26
  97. package/src/core/types/google-maps.types.js +1 -2
  98. package/src/core/utils/currency.util.js +1 -11
  99. package/src/core/utils/env.util.js +1 -8
  100. package/src/core/utils/object.util.js +1 -39
  101. package/src/core/utils/translations.util.js +0 -1
  102. package/src/core/utils/zod.util.js +1 -85
  103. package/src/db.js +1 -3
  104. package/src/features/access/access.handler.js +1 -91
  105. package/src/features/access/access.route.js +1 -220
  106. package/src/features/access/access.schema.js +1 -108
  107. package/src/features/access/access.service.js +1 -294
  108. package/src/features/analytics/analytics.handler.d.ts +2 -0
  109. package/src/features/analytics/analytics.handler.js +1 -0
  110. package/src/features/analytics/analytics.handler.js.map +1 -0
  111. package/src/features/analytics/analytics.route.d.ts +3 -0
  112. package/src/features/analytics/analytics.route.js +1 -0
  113. package/src/features/analytics/analytics.route.js.map +1 -0
  114. package/src/features/analytics/analytics.schema.d.ts +86 -0
  115. package/src/features/analytics/analytics.schema.js +1 -0
  116. package/src/features/analytics/analytics.schema.js.map +1 -0
  117. package/src/features/analytics/analytics.service.d.ts +45 -0
  118. package/src/features/analytics/analytics.service.js +1 -0
  119. package/src/features/analytics/analytics.service.js.map +1 -0
  120. package/src/features/cart/cart.handler.js +1 -17
  121. package/src/features/cart/cart.route.js +1 -32
  122. package/src/features/cart/cart.schema.d.ts +1 -1
  123. package/src/features/cart/cart.schema.js +1 -39
  124. package/src/features/cart/cart.service.d.ts +1 -1
  125. package/src/features/cart/cart.service.js +1 -97
  126. package/src/features/cart/cart.util.js +1 -76
  127. package/src/features/file/file.handler.js +1 -23
  128. package/src/features/file/file.route.js +1 -34
  129. package/src/features/file/file.schema.js +1 -77
  130. package/src/features/file/file.service.js +1 -66
  131. package/src/features/health/health.handler.js +1 -10
  132. package/src/features/health/health.route.js +1 -25
  133. package/src/features/index.d.ts +1 -0
  134. package/src/features/index.js +1 -16
  135. package/src/features/index.js.map +1 -1
  136. package/src/features/location/location.handler.js +1 -25
  137. package/src/features/location/location.route.js +1 -56
  138. package/src/features/location/location.schema.js +1 -50
  139. package/src/features/location/location.service.js +1 -141
  140. package/src/features/manufacturer/manufacturer.handler.js +1 -53
  141. package/src/features/manufacturer/manufacturer.route.js +1 -97
  142. package/src/features/manufacturer/manufacturer.schema.js +1 -125
  143. package/src/features/manufacturer/manufacturer.service.js +1 -190
  144. package/src/features/order/emails/order-confirmation.email.js +1 -229
  145. package/src/features/order/emails/order-confirmation.email.js.map +1 -1
  146. package/src/features/order/emails/order-notification.email.js +1 -229
  147. package/src/features/order/emails/order-notification.email.js.map +1 -1
  148. package/src/features/order/fulfilment.schema.js +1 -3
  149. package/src/features/order/order.handler.js +1 -54
  150. package/src/features/order/order.route.js +1 -111
  151. package/src/features/order/order.schema.d.ts +4 -4
  152. package/src/features/order/order.schema.js +1 -158
  153. package/src/features/order/order.service.d.ts +4 -4
  154. package/src/features/order/order.service.js +1 -306
  155. package/src/features/order/recipient.schema.js +1 -38
  156. package/src/features/organization/legal-entity.schema.js +1 -83
  157. package/src/features/organization/organization-configuration.schema.js +1 -115
  158. package/src/features/organization/organization.handler.js +1 -48
  159. package/src/features/organization/organization.route.js +1 -84
  160. package/src/features/organization/organization.schema.js +1 -64
  161. package/src/features/organization/organization.service.js +1 -334
  162. package/src/features/payment/payment.handler.js +1 -16
  163. package/src/features/payment/payment.route.js +1 -22
  164. package/src/features/payment/payment.schema.d.ts +3 -3
  165. package/src/features/payment/payment.schema.js +1 -46
  166. package/src/features/payment/payment.service.d.ts +1 -1
  167. package/src/features/payment/payment.service.js +1 -100
  168. package/src/features/payment/stripe.service.js +1 -164
  169. package/src/features/product/product-modifier.schema.js +1 -84
  170. package/src/features/product/product.handler.js +1 -87
  171. package/src/features/product/product.route.js +1 -179
  172. package/src/features/product/product.schema.d.ts +3 -3
  173. package/src/features/product/product.schema.js +1 -143
  174. package/src/features/product/product.service.d.ts +2 -2
  175. package/src/features/product/product.service.js +1 -440
  176. package/src/features/product-category/product-category.handler.js +1 -59
  177. package/src/features/product-category/product-category.route.js +1 -139
  178. package/src/features/product-category/product-category.schema.js +1 -86
  179. package/src/features/product-category/product-category.service.js +1 -220
  180. package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
  181. package/src/features/reservation/emails/reservation-cancellation.email.js.map +1 -1
  182. package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
  183. package/src/features/reservation/emails/reservation-confirmation.email.js.map +1 -1
  184. package/src/features/reservation/emails/reservation-notification.email.js +1 -93
  185. package/src/features/reservation/emails/reservation-notification.email.js.map +1 -1
  186. package/src/features/reservation/reservation.handler.js +1 -65
  187. package/src/features/reservation/reservation.route.js +1 -167
  188. package/src/features/reservation/reservation.schema.d.ts +1 -1
  189. package/src/features/reservation/reservation.schema.js +1 -51
  190. package/src/features/reservation/reservation.service.js +1 -231
  191. package/src/features/shipping/shipping.handler.js +1 -32
  192. package/src/features/shipping/shipping.route.js +1 -51
  193. package/src/features/shipping/shipping.service.js +1 -96
  194. package/src/features/shipping-method/shipping-method.handler.js +1 -60
  195. package/src/features/shipping-method/shipping-method.route.js +1 -144
  196. package/src/features/shipping-method/shipping-method.schema.js +1 -48
  197. package/src/features/shipping-method/shipping-method.service.js +1 -229
  198. package/src/features/shipping-method/shipping-zone.schema.js +1 -31
  199. package/src/features/webhook/webhook.handler.js +1 -50
  200. package/src/features/webhook/webhook.route.js +1 -33
  201. package/src/index.js +1 -6
  202. package/src/integrations/next.js +1 -82
  203. package/src/schemas/address.schema.js +1 -112
  204. package/src/schemas/currency.schema.js +1 -118
  205. package/src/schemas/error.schema.js +1 -12
  206. package/src/schemas/index.d.ts +1 -0
  207. package/src/schemas/index.js +1 -29
  208. package/src/schemas/index.js.map +1 -1
  209. package/src/schemas/locales.schema.js +1 -238
  210. package/src/schemas/number.schema.js +1 -29
  211. package/src/schemas/pagination.schema.js +1 -54
  212. package/src/schemas/params.schema.js +1 -20
  213. package/src/schemas/queries.schema.js +1 -6
  214. package/src/test/global-setup.js +1 -37
  215. package/src/test/integration/api-fixtures.js +1 -160
  216. package/src/test/integration/seed.js +1 -368
  217. package/src/test/integration/test-helpers.d.ts +2 -0
  218. package/src/test/integration/test-helpers.js +1 -154
  219. package/src/test/integration/test-helpers.js.map +1 -1
  220. package/src/test/setup-test-env.js +1 -7
@@ -1,220 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { createApiRoute } from "../../core/hono/hono";
3
- import { ErrorSchema, HeaderSchema, OrganizationParams, PaginationMetaSchema, PaginationQuerySchema, } from "../../schemas";
4
- import { CreateInvitationSchema, InvitationSchema, MemberSchema, UpdateMemberRoleSchema, UserInvitationSchema, } from "./access.schema";
5
- const memberPathParams = z.object({
6
- memberId: z.string().openapi({
7
- description: "ID of the member",
8
- example: "clf9876543210abcdef",
9
- param: {
10
- in: "path",
11
- name: "memberId",
12
- },
13
- }),
14
- organizationId: z.string().openapi({
15
- description: "ID of the organization",
16
- example: "cju0z9k4z0000l1qg5z1z1z1z",
17
- param: {
18
- in: "path",
19
- name: "organizationId",
20
- },
21
- }),
22
- });
23
- const getMembersRoute = createApiRoute({
24
- description: "Fetches a paginated list of members for an organization",
25
- headers: HeaderSchema,
26
- method: "GET",
27
- operationId: "getMembers",
28
- path: "/:organizationId/access/members",
29
- pathParams: OrganizationParams,
30
- query: PaginationQuerySchema,
31
- responses: {
32
- 200: z.object({
33
- list: z.array(MemberSchema),
34
- meta: PaginationMetaSchema,
35
- }),
36
- 400: ErrorSchema,
37
- 401: ErrorSchema,
38
- },
39
- summary: "Get Members",
40
- tags: ["Access"],
41
- });
42
- const getMemberRoute = createApiRoute({
43
- headers: HeaderSchema,
44
- method: "GET",
45
- operationId: "getMember",
46
- path: "/:organizationId/access/members/:memberId",
47
- pathParams: memberPathParams,
48
- responses: {
49
- 200: MemberSchema,
50
- 401: ErrorSchema,
51
- 404: ErrorSchema,
52
- },
53
- summary: "Get Member",
54
- tags: ["Access"],
55
- });
56
- const updateMemberRoleRoute = createApiRoute({
57
- body: UpdateMemberRoleSchema,
58
- description: "Updates a member's role in the organization",
59
- headers: HeaderSchema,
60
- method: "PUT",
61
- operationId: "updateMemberRole",
62
- path: "/:organizationId/access/members/:memberId",
63
- pathParams: memberPathParams,
64
- responses: {
65
- 200: MemberSchema,
66
- 400: ErrorSchema,
67
- 401: ErrorSchema,
68
- 404: ErrorSchema,
69
- },
70
- summary: "Update Member Role",
71
- tags: ["Access"],
72
- });
73
- const deleteMemberRoute = createApiRoute({
74
- description: "Removes a member from the organization",
75
- headers: HeaderSchema,
76
- method: "DELETE",
77
- operationId: "deleteMember",
78
- path: "/:organizationId/access/members/:memberId",
79
- pathParams: memberPathParams,
80
- responses: {
81
- 204: null,
82
- 400: ErrorSchema,
83
- 401: ErrorSchema,
84
- 404: ErrorSchema,
85
- },
86
- summary: "Delete Member",
87
- tags: ["Access"],
88
- });
89
- const createInvitationRoute = createApiRoute({
90
- body: CreateInvitationSchema,
91
- description: "Creates a new invitation for the organization",
92
- headers: HeaderSchema,
93
- method: "POST",
94
- operationId: "createInvitation",
95
- path: "/:organizationId/access/invitations",
96
- pathParams: OrganizationParams,
97
- responses: {
98
- 201: InvitationSchema,
99
- 400: ErrorSchema,
100
- 401: ErrorSchema,
101
- },
102
- summary: "Create Invitation",
103
- tags: ["Access"],
104
- });
105
- const getInvitationsRoute = createApiRoute({
106
- description: "Fetches a list of pending invitations for an organization",
107
- headers: HeaderSchema,
108
- method: "GET",
109
- operationId: "getInvitations",
110
- path: "/:organizationId/access/invitations",
111
- pathParams: OrganizationParams,
112
- responses: {
113
- 200: z.array(InvitationSchema),
114
- 401: ErrorSchema,
115
- },
116
- summary: "Get Invitations",
117
- tags: ["Access"],
118
- });
119
- const invitationPathParams = z.object({
120
- invitationId: z.string().openapi({
121
- description: "ID of the invitation",
122
- example: "inv_123",
123
- param: {
124
- in: "path",
125
- name: "invitationId",
126
- },
127
- }),
128
- });
129
- const getUserInvitationsRoute = createApiRoute({
130
- description: "Fetches pending invitations for the currently authenticated user",
131
- headers: HeaderSchema,
132
- method: "GET",
133
- operationId: "getUserInvitations",
134
- path: "/access/invitations/me",
135
- responses: {
136
- 200: z.array(UserInvitationSchema),
137
- 401: ErrorSchema,
138
- },
139
- summary: "Get User Invitations",
140
- tags: ["Access"],
141
- });
142
- const acceptInvitationRoute = createApiRoute({
143
- description: "Accepts a pending invitation and adds the user as a member",
144
- headers: HeaderSchema,
145
- method: "POST",
146
- operationId: "acceptInvitation",
147
- path: "/access/invitations/:invitationId/accept",
148
- pathParams: invitationPathParams,
149
- responses: {
150
- 200: MemberSchema,
151
- 400: ErrorSchema,
152
- 401: ErrorSchema,
153
- 404: ErrorSchema,
154
- },
155
- summary: "Accept Invitation",
156
- tags: ["Access"],
157
- });
158
- const deleteInvitationPathParams = z.object({
159
- invitationId: z.string().openapi({
160
- description: "ID of the invitation",
161
- example: "inv_123",
162
- param: {
163
- in: "path",
164
- name: "invitationId",
165
- },
166
- }),
167
- organizationId: z.string().openapi({
168
- description: "ID of the organization",
169
- example: "cju0z9k4z0000l1qg5z1z1z1z",
170
- param: {
171
- in: "path",
172
- name: "organizationId",
173
- },
174
- }),
175
- });
176
- const deleteInvitationRoute = createApiRoute({
177
- description: "Revokes a pending invitation",
178
- headers: HeaderSchema,
179
- method: "DELETE",
180
- operationId: "deleteInvitation",
181
- path: "/:organizationId/access/invitations/:invitationId",
182
- pathParams: deleteInvitationPathParams,
183
- responses: {
184
- 204: null,
185
- 400: ErrorSchema,
186
- 401: ErrorSchema,
187
- 404: ErrorSchema,
188
- },
189
- summary: "Delete Invitation",
190
- tags: ["Access"],
191
- });
192
- const leaveOrganizationRoute = createApiRoute({
193
- description: "Leave an organization by revoking your own membership",
194
- headers: HeaderSchema,
195
- method: "POST",
196
- operationId: "leaveOrganization",
197
- path: "/:organizationId/access/leave",
198
- pathParams: OrganizationParams,
199
- responses: {
200
- 204: null,
201
- 400: ErrorSchema,
202
- 401: ErrorSchema,
203
- 404: ErrorSchema,
204
- },
205
- summary: "Leave Organization",
206
- tags: ["Access"],
207
- });
208
- export const accessRoute = {
209
- getMembers: getMembersRoute,
210
- getMember: getMemberRoute,
211
- updateMemberRole: updateMemberRoleRoute,
212
- deleteMember: deleteMemberRoute,
213
- createInvitation: createInvitationRoute,
214
- deleteInvitation: deleteInvitationRoute,
215
- getInvitations: getInvitationsRoute,
216
- getUserInvitations: getUserInvitationsRoute,
217
- acceptInvitation: acceptInvitationRoute,
218
- leaveOrganization: leaveOrganizationRoute,
219
- };
220
- //# sourceMappingURL=access.route.js.map
1
+ import{z as t}from"@hono/zod-openapi";import{createApiRoute as a}from"../../core/hono/hono";import{ErrorSchema as e,HeaderSchema as n,OrganizationParams as i,PaginationMetaSchema as m,PaginationQuerySchema as c}from"../../schemas";import{CreateInvitationSchema as p,InvitationSchema as r,MemberSchema as o,UpdateMemberRoleSchema as d,UserInvitationSchema as h}from"./access.schema";const s=t.object({memberId:t.string().openapi({description:"ID of the member",example:"clf9876543210abcdef",param:{in:"path",name:"memberId"}}),organizationId:t.string().openapi({description:"ID of the organization",example:"cju0z9k4z0000l1qg5z1z1z1z",param:{in:"path",name:"organizationId"}})}),g=a({description:"Fetches a paginated list of members for an organization",headers:n,method:"GET",operationId:"getMembers",path:"/:organizationId/access/members",pathParams:i,query:c,responses:{200:t.object({list:t.array(o),meta:m}),400:e,401:e},summary:"Get Members",tags:["Access"]}),I=a({headers:n,method:"GET",operationId:"getMember",path:"/:organizationId/access/members/:memberId",pathParams:s,responses:{200:o,401:e,404:e},summary:"Get Member",tags:["Access"]}),v=a({body:d,description:"Updates a member's role in the organization",headers:n,method:"PUT",operationId:"updateMemberRole",path:"/:organizationId/access/members/:memberId",pathParams:s,responses:{200:o,400:e,401:e,404:e},summary:"Update Member Role",tags:["Access"]}),b=a({description:"Removes a member from the organization",headers:n,method:"DELETE",operationId:"deleteMember",path:"/:organizationId/access/members/:memberId",pathParams:s,responses:{204:null,400:e,401:e,404:e},summary:"Delete Member",tags:["Access"]}),z=a({body:p,description:"Creates a new invitation for the organization",headers:n,method:"POST",operationId:"createInvitation",path:"/:organizationId/access/invitations",pathParams:i,responses:{201:r,400:e,401:e},summary:"Create Invitation",tags:["Access"]}),l=a({description:"Fetches a list of pending invitations for an organization",headers:n,method:"GET",operationId:"getInvitations",path:"/:organizationId/access/invitations",pathParams:i,responses:{200:t.array(r),401:e},summary:"Get Invitations",tags:["Access"]}),u=t.object({invitationId:t.string().openapi({description:"ID of the invitation",example:"inv_123",param:{in:"path",name:"invitationId"}})}),P=a({description:"Fetches pending invitations for the currently authenticated user",headers:n,method:"GET",operationId:"getUserInvitations",path:"/access/invitations/me",responses:{200:t.array(h),401:e},summary:"Get User Invitations",tags:["Access"]}),y=a({description:"Accepts a pending invitation and adds the user as a member",headers:n,method:"POST",operationId:"acceptInvitation",path:"/access/invitations/:invitationId/accept",pathParams:u,responses:{200:o,400:e,401:e,404:e},summary:"Accept Invitation",tags:["Access"]}),M=t.object({invitationId:t.string().openapi({description:"ID of the invitation",example:"inv_123",param:{in:"path",name:"invitationId"}}),organizationId:t.string().openapi({description:"ID of the organization",example:"cju0z9k4z0000l1qg5z1z1z1z",param:{in:"path",name:"organizationId"}})}),R=a({description:"Revokes a pending invitation",headers:n,method:"DELETE",operationId:"deleteInvitation",path:"/:organizationId/access/invitations/:invitationId",pathParams:M,responses:{204:null,400:e,401:e,404:e},summary:"Delete Invitation",tags:["Access"]}),f=a({description:"Leave an organization by revoking your own membership",headers:n,method:"POST",operationId:"leaveOrganization",path:"/:organizationId/access/leave",pathParams:i,responses:{204:null,400:e,401:e,404:e},summary:"Leave Organization",tags:["Access"]});export const accessRoute={getMembers:g,getMember:I,updateMemberRole:v,deleteMember:b,createInvitation:z,deleteInvitation:R,getInvitations:l,getUserInvitations:P,acceptInvitation:y,leaveOrganization:f};
@@ -1,108 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const MemberSchema = z
3
- .object({
4
- id: z.string().openapi({
5
- example: "clf9876543210abcdef",
6
- description: "ID of the member",
7
- }),
8
- organizationId: z.string().openapi({
9
- example: "cju0z9k4z0000l1qg5z1z1z1z",
10
- description: "ID of the organization",
11
- }),
12
- userId: z.string().openapi({
13
- example: "usr_123",
14
- description: "ID of the user",
15
- }),
16
- role: z.string().openapi({
17
- example: "owner",
18
- description: "Role of the member in the organization",
19
- }),
20
- createdAt: z.date(),
21
- user: z
22
- .object({
23
- id: z.string(),
24
- firstname: z.string(),
25
- lastname: z.string(),
26
- email: z.string(),
27
- image: z.string().nullable().optional(),
28
- })
29
- .openapi({ description: "User details" }),
30
- })
31
- .openapi("Member");
32
- export const InvitationSchema = z
33
- .object({
34
- id: z.string().openapi({
35
- example: "inv_123",
36
- description: "ID of the invitation",
37
- }),
38
- organizationId: z.string().openapi({
39
- example: "cju0z9k4z0000l1qg5z1z1z1z",
40
- description: "ID of the organization",
41
- }),
42
- email: z.string().email().openapi({
43
- example: "user@example.com",
44
- description: "Email of the invited user",
45
- }),
46
- role: z.string().nullable().optional().openapi({
47
- example: "member",
48
- description: "Role assigned to the invitation",
49
- }),
50
- status: z.string().openapi({
51
- example: "pending",
52
- description: "Status of the invitation",
53
- }),
54
- expiresAt: z.date().openapi({
55
- description: "Expiration date of the invitation",
56
- }),
57
- inviterId: z.string().openapi({
58
- description: "ID of the user who created the invitation",
59
- }),
60
- createdAt: z.date().optional(),
61
- })
62
- .openapi("Invitation");
63
- export const CreateInvitationSchema = z
64
- .object({
65
- email: z.string().email("A valid email is required").openapi({
66
- example: "user@example.com",
67
- description: "Email of the user to invite",
68
- }),
69
- role: z.string().min(1, "Role is required").openapi({
70
- example: "member",
71
- description: "Role to assign to the invited user",
72
- }),
73
- })
74
- .openapi("CreateInvitation");
75
- export const UpdateMemberRoleSchema = z
76
- .object({
77
- role: z.string().min(1, "Role is required").openapi({
78
- example: "admin",
79
- description: "New role for the member",
80
- }),
81
- })
82
- .openapi("UpdateMemberRole");
83
- export const UserInvitationSchema = z
84
- .object({
85
- id: z.string().openapi({
86
- example: "inv_123",
87
- description: "ID of the invitation",
88
- }),
89
- organizationId: z.string().openapi({
90
- example: "cju0z9k4z0000l1qg5z1z1z1z",
91
- description: "ID of the organization",
92
- }),
93
- role: z.string().nullable().optional().openapi({
94
- example: "member",
95
- description: "Role assigned to the invitation",
96
- }),
97
- expiresAt: z.date().openapi({
98
- description: "Expiration date of the invitation",
99
- }),
100
- organization: z
101
- .object({
102
- id: z.string(),
103
- name: z.string(),
104
- })
105
- .openapi({ description: "Organization details" }),
106
- })
107
- .openapi("UserInvitation");
108
- //# sourceMappingURL=access.schema.js.map
1
+ import{z as e}from"@hono/zod-openapi";export const MemberSchema=e.object({id:e.string().openapi({example:"clf9876543210abcdef",description:"ID of the member"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),userId:e.string().openapi({example:"usr_123",description:"ID of the user"}),role:e.string().openapi({example:"owner",description:"Role of the member in the organization"}),createdAt:e.date(),user:e.object({id:e.string(),firstname:e.string(),lastname:e.string(),email:e.string(),image:e.string().nullable().optional()}).openapi({description:"User details"})}).openapi("Member"),InvitationSchema=e.object({id:e.string().openapi({example:"inv_123",description:"ID of the invitation"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),email:e.string().email().openapi({example:"user@example.com",description:"Email of the invited user"}),role:e.string().nullable().optional().openapi({example:"member",description:"Role assigned to the invitation"}),status:e.string().openapi({example:"pending",description:"Status of the invitation"}),expiresAt:e.date().openapi({description:"Expiration date of the invitation"}),inviterId:e.string().openapi({description:"ID of the user who created the invitation"}),createdAt:e.date().optional()}).openapi("Invitation"),CreateInvitationSchema=e.object({email:e.string().email("A valid email is required").openapi({example:"user@example.com",description:"Email of the user to invite"}),role:e.string().min(1,"Role is required").openapi({example:"member",description:"Role to assign to the invited user"})}).openapi("CreateInvitation"),UpdateMemberRoleSchema=e.object({role:e.string().min(1,"Role is required").openapi({example:"admin",description:"New role for the member"})}).openapi("UpdateMemberRole"),UserInvitationSchema=e.object({id:e.string().openapi({example:"inv_123",description:"ID of the invitation"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),role:e.string().nullable().optional().openapi({example:"member",description:"Role assigned to the invitation"}),expiresAt:e.date().openapi({description:"Expiration date of the invitation"}),organization:e.object({id:e.string(),name:e.string()}).openapi({description:"Organization details"})}).openapi("UserInvitation");
@@ -1,294 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { z } from "@hono/zod-openapi";
3
- import { HttpException } from "../../core/exceptions/http-exception";
4
- import { PaginationMetaSchema } from "../../schemas";
5
- import { InvitationSchema, MemberSchema, UserInvitationSchema, } from "./access.schema";
6
- class AccessService {
7
- constructor(prisma) {
8
- this.prisma = prisma;
9
- }
10
- getMembers(organizationId, query) {
11
- return __awaiter(this, void 0, void 0, function* () {
12
- const { page = 1, limit = 10, search } = query;
13
- const [list, meta] = yield this.prisma.member
14
- .paginate({
15
- orderBy: { createdAt: "desc" },
16
- where: Object.assign({ organizationId }, (search && {
17
- user: {
18
- OR: [
19
- { firstname: { contains: search, mode: "insensitive" } },
20
- { lastname: { contains: search, mode: "insensitive" } },
21
- { email: { contains: search, mode: "insensitive" } },
22
- ],
23
- },
24
- })),
25
- include: {
26
- user: {
27
- select: {
28
- id: true,
29
- firstname: true,
30
- lastname: true,
31
- email: true,
32
- image: true,
33
- },
34
- },
35
- },
36
- })
37
- .withPages({ page, limit });
38
- return z
39
- .object({
40
- meta: PaginationMetaSchema,
41
- list: z.array(MemberSchema),
42
- })
43
- .parse({ meta, list });
44
- });
45
- }
46
- getMember(organizationId, memberId) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- const member = yield this.prisma.member.findUnique({
49
- where: { id: memberId, organizationId },
50
- include: {
51
- user: {
52
- select: {
53
- id: true,
54
- firstname: true,
55
- lastname: true,
56
- email: true,
57
- image: true,
58
- },
59
- },
60
- },
61
- });
62
- if (!member) {
63
- throw new HttpException(404, "Member not found");
64
- }
65
- return MemberSchema.parse(member);
66
- });
67
- }
68
- updateMemberRole(organizationId, memberId, currentUserId, body) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- const member = yield this.prisma.member.findUnique({
71
- where: { id: memberId, organizationId },
72
- include: { user: { select: { id: true, firstname: true, lastname: true, email: true, image: true } } },
73
- });
74
- if (!member) {
75
- throw new HttpException(404, "Member not found");
76
- }
77
- // Prevent demotion of the last owner
78
- if (member.role === "owner" && body.role !== "owner") {
79
- const ownerCount = yield this.prisma.member.count({
80
- where: { organizationId, role: "owner" },
81
- });
82
- if (ownerCount <= 1) {
83
- throw new HttpException(400, "Cannot change the role of the last owner. Promote another member to owner first.");
84
- }
85
- }
86
- const updated = yield this.prisma.member.update({
87
- where: { id: memberId, organizationId },
88
- data: { role: body.role },
89
- include: {
90
- user: {
91
- select: {
92
- id: true,
93
- firstname: true,
94
- lastname: true,
95
- email: true,
96
- image: true,
97
- },
98
- },
99
- },
100
- });
101
- return MemberSchema.parse(updated);
102
- });
103
- }
104
- deleteMember(organizationId, memberId, currentUserId) {
105
- return __awaiter(this, void 0, void 0, function* () {
106
- const member = yield this.prisma.member.findUnique({
107
- where: { id: memberId, organizationId },
108
- });
109
- if (!member) {
110
- throw new HttpException(404, "Member not found");
111
- }
112
- // Prevent self-removal
113
- if (member.userId === currentUserId) {
114
- throw new HttpException(400, "You cannot remove yourself from the organization");
115
- }
116
- // Prevent removal of the last owner
117
- if (member.role === "owner") {
118
- const ownerCount = yield this.prisma.member.count({
119
- where: { organizationId, role: "owner" },
120
- });
121
- if (ownerCount <= 1) {
122
- throw new HttpException(400, "Cannot remove the last owner. Transfer ownership first.");
123
- }
124
- }
125
- yield this.prisma.member.delete({
126
- where: { id: memberId, organizationId },
127
- });
128
- });
129
- }
130
- leaveOrganization(organizationId, userId) {
131
- return __awaiter(this, void 0, void 0, function* () {
132
- const member = yield this.prisma.member.findFirst({
133
- where: { organizationId, userId },
134
- });
135
- if (!member) {
136
- throw new HttpException(404, "You are not a member of this organization");
137
- }
138
- if (member.role === "owner") {
139
- const ownerCount = yield this.prisma.member.count({
140
- where: { organizationId, role: "owner" },
141
- });
142
- if (ownerCount <= 1) {
143
- throw new HttpException(400, "Cannot leave as the last owner. Transfer ownership first.");
144
- }
145
- }
146
- yield this.prisma.member.delete({
147
- where: { id: member.id, organizationId },
148
- });
149
- });
150
- }
151
- createInvitation(organizationId, inviterId, body) {
152
- return __awaiter(this, void 0, void 0, function* () {
153
- // Check for duplicate active invitation
154
- const existing = yield this.prisma.invitation.findFirst({
155
- where: {
156
- organizationId,
157
- email: body.email,
158
- status: "pending",
159
- expiresAt: { gt: new Date() },
160
- },
161
- });
162
- if (existing) {
163
- throw new HttpException(400, "An active invitation already exists for this email address");
164
- }
165
- // Check if user is already a member
166
- const existingMember = yield this.prisma.member.findFirst({
167
- where: {
168
- organizationId,
169
- user: { email: body.email },
170
- },
171
- });
172
- if (existingMember) {
173
- throw new HttpException(400, "This user is already a member of the organization");
174
- }
175
- const invitation = yield this.prisma.invitation.create({
176
- data: {
177
- id: crypto.randomUUID(),
178
- organizationId,
179
- email: body.email,
180
- role: body.role,
181
- status: "pending",
182
- inviterId,
183
- expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days
184
- },
185
- });
186
- return InvitationSchema.parse(invitation);
187
- });
188
- }
189
- getInvitations(organizationId) {
190
- return __awaiter(this, void 0, void 0, function* () {
191
- const invitations = yield this.prisma.invitation.findMany({
192
- where: {
193
- organizationId,
194
- status: "pending",
195
- },
196
- orderBy: { expiresAt: "desc" },
197
- });
198
- return z.array(InvitationSchema).parse(invitations);
199
- });
200
- }
201
- deleteInvitation(organizationId, invitationId) {
202
- return __awaiter(this, void 0, void 0, function* () {
203
- const invitation = yield this.prisma.invitation.findUnique({
204
- where: { id: invitationId, organizationId },
205
- });
206
- if (!invitation) {
207
- throw new HttpException(404, "Invitation not found");
208
- }
209
- if (invitation.status !== "pending") {
210
- throw new HttpException(400, "Only pending invitations can be revoked");
211
- }
212
- yield this.prisma.invitation.delete({
213
- where: { id: invitationId },
214
- });
215
- });
216
- }
217
- getUserInvitations(email) {
218
- return __awaiter(this, void 0, void 0, function* () {
219
- const invitations = yield this.prisma.invitation.findMany({
220
- where: {
221
- email,
222
- status: "pending",
223
- expiresAt: { gt: new Date() },
224
- },
225
- include: {
226
- organization: {
227
- select: { id: true, name: true },
228
- },
229
- },
230
- orderBy: { expiresAt: "desc" },
231
- });
232
- return z.array(UserInvitationSchema).parse(invitations);
233
- });
234
- }
235
- acceptInvitation(invitationId, userId) {
236
- return __awaiter(this, void 0, void 0, function* () {
237
- var _a;
238
- const invitation = yield this.prisma.invitation.findUnique({
239
- where: { id: invitationId },
240
- });
241
- if (!invitation) {
242
- throw new HttpException(404, "Invitation not found");
243
- }
244
- if (invitation.status !== "pending") {
245
- throw new HttpException(400, "Invitation is no longer pending");
246
- }
247
- if (invitation.expiresAt < new Date()) {
248
- throw new HttpException(400, "Invitation has expired");
249
- }
250
- const user = yield this.prisma.user.findUnique({
251
- where: { id: userId },
252
- });
253
- if (!user || user.email !== invitation.email) {
254
- throw new HttpException(400, "Invitation does not belong to this user");
255
- }
256
- const existingMember = yield this.prisma.member.findFirst({
257
- where: {
258
- organizationId: invitation.organizationId,
259
- userId,
260
- },
261
- });
262
- if (existingMember) {
263
- throw new HttpException(400, "You are already a member of this organization");
264
- }
265
- const [member] = yield this.prisma.$transaction([
266
- this.prisma.member.create({
267
- data: {
268
- organizationId: invitation.organizationId,
269
- userId,
270
- role: (_a = invitation.role) !== null && _a !== void 0 ? _a : "member",
271
- },
272
- include: {
273
- user: {
274
- select: {
275
- id: true,
276
- firstname: true,
277
- lastname: true,
278
- email: true,
279
- image: true,
280
- },
281
- },
282
- },
283
- }),
284
- this.prisma.invitation.update({
285
- where: { id: invitationId },
286
- data: { status: "accepted" },
287
- }),
288
- ]);
289
- return MemberSchema.parse(member);
290
- });
291
- }
292
- }
293
- export { AccessService };
294
- //# sourceMappingURL=access.service.js.map
1
+ import{__awaiter as o}from"tslib";import{z as d}from"@hono/zod-openapi";import{HttpException as n}from"../../core/exceptions/http-exception";import{PaginationMetaSchema as l}from"../../schemas";import{InvitationSchema as h,MemberSchema as u,UserInvitationSchema as w}from"./access.schema";class c{constructor(e){this.prisma=e}getMembers(e,i){return o(this,void 0,void 0,function*(){const{page:t=1,limit:r=10,search:s}=i,[a,m]=yield this.prisma.member.paginate({orderBy:{createdAt:"desc"},where:Object.assign({organizationId:e},s&&{user:{OR:[{firstname:{contains:s,mode:"insensitive"}},{lastname:{contains:s,mode:"insensitive"}},{email:{contains:s,mode:"insensitive"}}]}}),include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}}).withPages({page:t,limit:r});return d.object({meta:l,list:d.array(u)}).parse({meta:m,list:a})})}getMember(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.member.findUnique({where:{id:i,organizationId:e},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});if(!t)throw new n(404,"Member not found");return u.parse(t)})}updateMemberRole(e,i,t,r){return o(this,void 0,void 0,function*(){const s=yield this.prisma.member.findUnique({where:{id:i,organizationId:e},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});if(!s)throw new n(404,"Member not found");if(s.role==="owner"&&r.role!=="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot change the role of the last owner. Promote another member to owner first.");const a=yield this.prisma.member.update({where:{id:i,organizationId:e},data:{role:r.role},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});return u.parse(a)})}deleteMember(e,i,t){return o(this,void 0,void 0,function*(){const r=yield this.prisma.member.findUnique({where:{id:i,organizationId:e}});if(!r)throw new n(404,"Member not found");if(r.userId===t)throw new n(400,"You cannot remove yourself from the organization");if(r.role==="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot remove the last owner. Transfer ownership first.");yield this.prisma.member.delete({where:{id:i,organizationId:e}})})}leaveOrganization(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.member.findFirst({where:{organizationId:e,userId:i}});if(!t)throw new n(404,"You are not a member of this organization");if(t.role==="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot leave as the last owner. Transfer ownership first.");yield this.prisma.member.delete({where:{id:t.id,organizationId:e}})})}createInvitation(e,i,t){return o(this,void 0,void 0,function*(){if(yield this.prisma.invitation.findFirst({where:{organizationId:e,email:t.email,status:"pending",expiresAt:{gt:new Date}}}))throw new n(400,"An active invitation already exists for this email address");if(yield this.prisma.member.findFirst({where:{organizationId:e,user:{email:t.email}}}))throw new n(400,"This user is already a member of the organization");const a=yield this.prisma.invitation.create({data:{id:crypto.randomUUID(),organizationId:e,email:t.email,role:t.role,status:"pending",inviterId:i,expiresAt:new Date(Date.now()+10080*60*1e3)}});return h.parse(a)})}getInvitations(e){return o(this,void 0,void 0,function*(){const i=yield this.prisma.invitation.findMany({where:{organizationId:e,status:"pending"},orderBy:{expiresAt:"desc"}});return d.array(h).parse(i)})}deleteInvitation(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.invitation.findUnique({where:{id:i,organizationId:e}});if(!t)throw new n(404,"Invitation not found");if(t.status!=="pending")throw new n(400,"Only pending invitations can be revoked");yield this.prisma.invitation.delete({where:{id:i}})})}getUserInvitations(e){return o(this,void 0,void 0,function*(){const i=yield this.prisma.invitation.findMany({where:{email:e,status:"pending",expiresAt:{gt:new Date}},include:{organization:{select:{id:!0,name:!0}}},orderBy:{expiresAt:"desc"}});return d.array(w).parse(i)})}acceptInvitation(e,i){return o(this,void 0,void 0,function*(){var t;const r=yield this.prisma.invitation.findUnique({where:{id:e}});if(!r)throw new n(404,"Invitation not found");if(r.status!=="pending")throw new n(400,"Invitation is no longer pending");if(r.expiresAt<new Date)throw new n(400,"Invitation has expired");const s=yield this.prisma.user.findUnique({where:{id:i}});if(!s||s.email!==r.email)throw new n(400,"Invitation does not belong to this user");if(yield this.prisma.member.findFirst({where:{organizationId:r.organizationId,userId:i}}))throw new n(400,"You are already a member of this organization");const[m]=yield this.prisma.$transaction([this.prisma.member.create({data:{organizationId:r.organizationId,userId:i,role:(t=r.role)!==null&&t!==void 0?t:"member"},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}}),this.prisma.invitation.update({where:{id:e},data:{status:"accepted"}})]);return u.parse(m)})}}export{c as AccessService};
@@ -0,0 +1,2 @@
1
+ import { PrismaClientType } from "../../core/lib/prisma";
2
+ export declare const buildAnalyticsHandler: (prisma: PrismaClientType) => import("@hono/zod-openapi").OpenAPIHono<import("../../core/hono/hono").AppBindings, {}, "/">;
@@ -0,0 +1 @@
1
+ import{__awaiter as s}from"tslib";import{createApiRouter as c}from"../../core/hono/hono";import{analyticsRoute as d}from"./analytics.route";import{AnalyticsService as p}from"./analytics.service";export const buildAnalyticsHandler=t=>{const r=c();return r.openapi(d.getOverview,e=>s(void 0,void 0,void 0,function*(){const i=e.get("auth"),o=e.req.valid("param"),a=e.req.valid("query");yield i.isGranted("read");const n=yield new p(t).getOverview(o.organizationId,a);return e.json(n,200)})),r};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.handler.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/analytics/analytics.handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAwB,EAAE,EAAE;IAChE,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAE9B,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,CAAO,CAAM,EAAE,EAAE;QACvD,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEnC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE7B,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAEvE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC,CAAA,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const analyticsRoute: {
2
+ getOverview: any;
3
+ };
@@ -0,0 +1 @@
1
+ import{createApiRoute as a}from"../../core/hono/hono";import{ErrorSchema as e,HeaderSchema as r,OrganizationParams as t}from"../../schemas";import{AnalyticsOverviewQuerySchema as i,AnalyticsOverviewSchema as o}from"./analytics.schema";const n=a({description:"Returns dashboard analytics for an organization within a date range.",headers:r,method:"GET",operationId:"getAnalyticsOverview",path:"/:organizationId/analytics/overview",pathParams:t,query:i,responses:{200:o,400:e,401:e,404:e},summary:"Get Analytics Overview",tags:["Analytics"]});export const analyticsRoute={getOverview:n};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.route.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/analytics/analytics.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,yBAAyB,GAAG,cAAc,CAAC;IAC/C,WAAW,EACT,sEAAsE;IACxE,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,sBAAsB;IACnC,IAAI,EAAE,qCAAqC;IAC3C,UAAU,EAAE,kBAAkB;IAC9B,KAAK,EAAE,4BAA4B;IACnC,SAAS,EAAE;QACT,GAAG,EAAE,uBAAuB;QAC5B,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;KACjB;IACD,OAAO,EAAE,wBAAwB;IACjC,IAAI,EAAE,CAAC,WAAW,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,yBAAyB;CACvC,CAAC"}