sidekick-server-2 0.1.1

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 (218) hide show
  1. package/README.md +223 -0
  2. package/dist/ai/index.d.ts +2 -0
  3. package/dist/ai/index.d.ts.map +1 -0
  4. package/dist/ai/index.js +2 -0
  5. package/dist/ai/index.js.map +1 -0
  6. package/dist/ai/perplexity-ai.d.ts +3 -0
  7. package/dist/ai/perplexity-ai.d.ts.map +1 -0
  8. package/dist/ai/perplexity-ai.js +28 -0
  9. package/dist/ai/perplexity-ai.js.map +1 -0
  10. package/dist/app-config.d.ts +13 -0
  11. package/dist/app-config.d.ts.map +1 -0
  12. package/dist/app-config.js +33 -0
  13. package/dist/app-config.js.map +1 -0
  14. package/dist/cors-config.d.ts +9 -0
  15. package/dist/cors-config.d.ts.map +1 -0
  16. package/dist/cors-config.js +24 -0
  17. package/dist/cors-config.js.map +1 -0
  18. package/dist/db-connection.d.ts +13 -0
  19. package/dist/db-connection.d.ts.map +1 -0
  20. package/dist/db-connection.js +22 -0
  21. package/dist/db-connection.js.map +1 -0
  22. package/dist/error-handler.d.ts +3 -0
  23. package/dist/error-handler.d.ts.map +1 -0
  24. package/dist/error-handler.js +15 -0
  25. package/dist/error-handler.js.map +1 -0
  26. package/dist/index.d.ts +19 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +87 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/local-cache.d.ts +14 -0
  31. package/dist/local-cache.d.ts.map +1 -0
  32. package/dist/local-cache.js +44 -0
  33. package/dist/local-cache.js.map +1 -0
  34. package/dist/r2-buckets/get-signed-url.d.ts +2 -0
  35. package/dist/r2-buckets/get-signed-url.d.ts.map +1 -0
  36. package/dist/r2-buckets/get-signed-url.js +22 -0
  37. package/dist/r2-buckets/get-signed-url.js.map +1 -0
  38. package/dist/r2-buckets/index.d.ts +3 -0
  39. package/dist/r2-buckets/index.d.ts.map +1 -0
  40. package/dist/r2-buckets/index.js +3 -0
  41. package/dist/r2-buckets/index.js.map +1 -0
  42. package/dist/r2-buckets/r2-client.d.ts +3 -0
  43. package/dist/r2-buckets/r2-client.d.ts.map +1 -0
  44. package/dist/r2-buckets/r2-client.js +18 -0
  45. package/dist/r2-buckets/r2-client.js.map +1 -0
  46. package/dist/r2-buckets/upload-r2.d.ts +11 -0
  47. package/dist/r2-buckets/upload-r2.d.ts.map +1 -0
  48. package/dist/r2-buckets/upload-r2.js +49 -0
  49. package/dist/r2-buckets/upload-r2.js.map +1 -0
  50. package/dist/routes/authentication/check-session.d.ts +4 -0
  51. package/dist/routes/authentication/check-session.d.ts.map +1 -0
  52. package/dist/routes/authentication/check-session.js +79 -0
  53. package/dist/routes/authentication/check-session.js.map +1 -0
  54. package/dist/routes/authentication/login-router.d.ts +3 -0
  55. package/dist/routes/authentication/login-router.d.ts.map +1 -0
  56. package/dist/routes/authentication/login-router.js +83 -0
  57. package/dist/routes/authentication/login-router.js.map +1 -0
  58. package/dist/routes/authentication/reset-password.d.ts +3 -0
  59. package/dist/routes/authentication/reset-password.d.ts.map +1 -0
  60. package/dist/routes/authentication/reset-password.js +92 -0
  61. package/dist/routes/authentication/reset-password.js.map +1 -0
  62. package/dist/routes/authentication/send-otp-router.d.ts +3 -0
  63. package/dist/routes/authentication/send-otp-router.d.ts.map +1 -0
  64. package/dist/routes/authentication/send-otp-router.js +89 -0
  65. package/dist/routes/authentication/send-otp-router.js.map +1 -0
  66. package/dist/routes/authentication/user-profile.d.ts +3 -0
  67. package/dist/routes/authentication/user-profile.d.ts.map +1 -0
  68. package/dist/routes/authentication/user-profile.js +44 -0
  69. package/dist/routes/authentication/user-profile.js.map +1 -0
  70. package/dist/routes/authentication/user-registration-router.d.ts +3 -0
  71. package/dist/routes/authentication/user-registration-router.d.ts.map +1 -0
  72. package/dist/routes/authentication/user-registration-router.js +120 -0
  73. package/dist/routes/authentication/user-registration-router.js.map +1 -0
  74. package/dist/routes/authentication/validator.d.ts +14 -0
  75. package/dist/routes/authentication/validator.d.ts.map +1 -0
  76. package/dist/routes/authentication/validator.js +69 -0
  77. package/dist/routes/authentication/validator.js.map +1 -0
  78. package/dist/routes/countries/countries-router.d.ts +3 -0
  79. package/dist/routes/countries/countries-router.d.ts.map +1 -0
  80. package/dist/routes/countries/countries-router.js +23 -0
  81. package/dist/routes/countries/countries-router.js.map +1 -0
  82. package/dist/routes/feature-flags/feature-flags.d.ts +5 -0
  83. package/dist/routes/feature-flags/feature-flags.d.ts.map +1 -0
  84. package/dist/routes/feature-flags/feature-flags.js +28 -0
  85. package/dist/routes/feature-flags/feature-flags.js.map +1 -0
  86. package/dist/routes/index.d.ts +9 -0
  87. package/dist/routes/index.d.ts.map +1 -0
  88. package/dist/routes/index.js +92 -0
  89. package/dist/routes/index.js.map +1 -0
  90. package/dist/routes/link-metadata.d.ts +3 -0
  91. package/dist/routes/link-metadata.d.ts.map +1 -0
  92. package/dist/routes/link-metadata.js +34 -0
  93. package/dist/routes/link-metadata.js.map +1 -0
  94. package/dist/routes/orgs/index.d.ts +2 -0
  95. package/dist/routes/orgs/index.d.ts.map +1 -0
  96. package/dist/routes/orgs/index.js +2 -0
  97. package/dist/routes/orgs/index.js.map +1 -0
  98. package/dist/routes/orgs/invitation.d.ts +3 -0
  99. package/dist/routes/orgs/invitation.d.ts.map +1 -0
  100. package/dist/routes/orgs/invitation.js +103 -0
  101. package/dist/routes/orgs/invitation.js.map +1 -0
  102. package/dist/routes/orgs/org-delete.d.ts +3 -0
  103. package/dist/routes/orgs/org-delete.d.ts.map +1 -0
  104. package/dist/routes/orgs/org-delete.js +53 -0
  105. package/dist/routes/orgs/org-delete.js.map +1 -0
  106. package/dist/routes/orgs/org-get.d.ts +3 -0
  107. package/dist/routes/orgs/org-get.d.ts.map +1 -0
  108. package/dist/routes/orgs/org-get.js +45 -0
  109. package/dist/routes/orgs/org-get.js.map +1 -0
  110. package/dist/routes/orgs/org-members.d.ts +12 -0
  111. package/dist/routes/orgs/org-members.d.ts.map +1 -0
  112. package/dist/routes/orgs/org-members.js +560 -0
  113. package/dist/routes/orgs/org-members.js.map +1 -0
  114. package/dist/routes/orgs/org-post.d.ts +3 -0
  115. package/dist/routes/orgs/org-post.d.ts.map +1 -0
  116. package/dist/routes/orgs/org-post.js +89 -0
  117. package/dist/routes/orgs/org-post.js.map +1 -0
  118. package/dist/routes/orgs/org-put.d.ts +3 -0
  119. package/dist/routes/orgs/org-put.d.ts.map +1 -0
  120. package/dist/routes/orgs/org-put.js +87 -0
  121. package/dist/routes/orgs/org-put.js.map +1 -0
  122. package/dist/routes/orgs/org-registration-router.d.ts +3 -0
  123. package/dist/routes/orgs/org-registration-router.d.ts.map +1 -0
  124. package/dist/routes/orgs/org-registration-router.js +12 -0
  125. package/dist/routes/orgs/org-registration-router.js.map +1 -0
  126. package/dist/routes/orgs/org-utils.d.ts +14 -0
  127. package/dist/routes/orgs/org-utils.d.ts.map +1 -0
  128. package/dist/routes/orgs/org-utils.js +234 -0
  129. package/dist/routes/orgs/org-utils.js.map +1 -0
  130. package/dist/routes/orgs/premium-org-utils.d.ts +3 -0
  131. package/dist/routes/orgs/premium-org-utils.d.ts.map +1 -0
  132. package/dist/routes/orgs/premium-org-utils.js +61 -0
  133. package/dist/routes/orgs/premium-org-utils.js.map +1 -0
  134. package/dist/routes/paid-plans/billingsdk-config.d.ts +36 -0
  135. package/dist/routes/paid-plans/billingsdk-config.d.ts.map +1 -0
  136. package/dist/routes/paid-plans/billingsdk-config.js +2 -0
  137. package/dist/routes/paid-plans/billingsdk-config.js.map +1 -0
  138. package/dist/routes/paid-plans/get-subscription-config.d.ts +3 -0
  139. package/dist/routes/paid-plans/get-subscription-config.d.ts.map +1 -0
  140. package/dist/routes/paid-plans/get-subscription-config.js +25 -0
  141. package/dist/routes/paid-plans/get-subscription-config.js.map +1 -0
  142. package/dist/routes/paid-plans/payment-gateway.d.ts +3 -0
  143. package/dist/routes/paid-plans/payment-gateway.d.ts.map +1 -0
  144. package/dist/routes/paid-plans/payment-gateway.js +324 -0
  145. package/dist/routes/paid-plans/payment-gateway.js.map +1 -0
  146. package/dist/routes/paid-plans/purchased-plans.d.ts +8 -0
  147. package/dist/routes/paid-plans/purchased-plans.d.ts.map +1 -0
  148. package/dist/routes/paid-plans/purchased-plans.js +191 -0
  149. package/dist/routes/paid-plans/purchased-plans.js.map +1 -0
  150. package/dist/routes/paid-plans/subscription-utils.d.ts +25 -0
  151. package/dist/routes/paid-plans/subscription-utils.d.ts.map +1 -0
  152. package/dist/routes/paid-plans/subscription-utils.js +156 -0
  153. package/dist/routes/paid-plans/subscription-utils.js.map +1 -0
  154. package/dist/s3-buckets/get-signed-url.d.ts +2 -0
  155. package/dist/s3-buckets/get-signed-url.d.ts.map +1 -0
  156. package/dist/s3-buckets/get-signed-url.js +22 -0
  157. package/dist/s3-buckets/get-signed-url.js.map +1 -0
  158. package/dist/s3-buckets/index.d.ts +3 -0
  159. package/dist/s3-buckets/index.d.ts.map +1 -0
  160. package/dist/s3-buckets/index.js +3 -0
  161. package/dist/s3-buckets/index.js.map +1 -0
  162. package/dist/s3-buckets/s3-client.d.ts +3 -0
  163. package/dist/s3-buckets/s3-client.d.ts.map +1 -0
  164. package/dist/s3-buckets/s3-client.js +17 -0
  165. package/dist/s3-buckets/s3-client.js.map +1 -0
  166. package/dist/s3-buckets/upload-s3.d.ts +11 -0
  167. package/dist/s3-buckets/upload-s3.d.ts.map +1 -0
  168. package/dist/s3-buckets/upload-s3.js +51 -0
  169. package/dist/s3-buckets/upload-s3.js.map +1 -0
  170. package/dist/secret.d.ts +4 -0
  171. package/dist/secret.d.ts.map +1 -0
  172. package/dist/secret.js +11 -0
  173. package/dist/secret.js.map +1 -0
  174. package/dist/socket-config.d.ts +4 -0
  175. package/dist/socket-config.d.ts.map +1 -0
  176. package/dist/socket-config.js +23 -0
  177. package/dist/socket-config.js.map +1 -0
  178. package/dist/types.d.ts +141 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +2 -0
  181. package/dist/types.js.map +1 -0
  182. package/dist/utils/common-utils.d.ts +61 -0
  183. package/dist/utils/common-utils.d.ts.map +1 -0
  184. package/dist/utils/common-utils.js +99 -0
  185. package/dist/utils/common-utils.js.map +1 -0
  186. package/dist/utils/email-helper.d.ts +6 -0
  187. package/dist/utils/email-helper.d.ts.map +1 -0
  188. package/dist/utils/email-helper.js +33 -0
  189. package/dist/utils/email-helper.js.map +1 -0
  190. package/dist/utils/enums.d.ts +17 -0
  191. package/dist/utils/enums.d.ts.map +1 -0
  192. package/dist/utils/enums.js +27 -0
  193. package/dist/utils/enums.js.map +1 -0
  194. package/dist/utils/error-logger.d.ts +4 -0
  195. package/dist/utils/error-logger.d.ts.map +1 -0
  196. package/dist/utils/error-logger.js +30 -0
  197. package/dist/utils/error-logger.js.map +1 -0
  198. package/dist/utils/index.d.ts +9 -0
  199. package/dist/utils/index.d.ts.map +1 -0
  200. package/dist/utils/index.js +9 -0
  201. package/dist/utils/index.js.map +1 -0
  202. package/dist/utils/otp-helper.d.ts +5 -0
  203. package/dist/utils/otp-helper.d.ts.map +1 -0
  204. package/dist/utils/otp-helper.js +89 -0
  205. package/dist/utils/otp-helper.js.map +1 -0
  206. package/dist/utils/response-utils.d.ts +8 -0
  207. package/dist/utils/response-utils.d.ts.map +1 -0
  208. package/dist/utils/response-utils.js +37 -0
  209. package/dist/utils/response-utils.js.map +1 -0
  210. package/dist/utils/sql-helper.d.ts +27 -0
  211. package/dist/utils/sql-helper.d.ts.map +1 -0
  212. package/dist/utils/sql-helper.js +97 -0
  213. package/dist/utils/sql-helper.js.map +1 -0
  214. package/dist/utils/type.d.ts +81 -0
  215. package/dist/utils/type.d.ts.map +1 -0
  216. package/dist/utils/type.js +2 -0
  217. package/dist/utils/type.js.map +1 -0
  218. package/package.json +70 -0
@@ -0,0 +1,120 @@
1
+ import express from 'express';
2
+ import { getRequestFromRoute, hashPassword } from '../../utils/common-utils.js';
3
+ import { INVITATION_ENUMS } from '../../utils/enums.js';
4
+ import logger from '../../utils/error-logger.js';
5
+ import { cachedOTPs, validateOTP } from '../../utils/otp-helper.js';
6
+ import { getErrorResponseObj, getResponseObj, sendErrorResponse, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom, } from '../../utils/response-utils.js';
7
+ import { executeSql, initializeConnection, insertRecords, updateRecords } from '../../utils/sql-helper.js';
8
+ import { includeUsersInOrg } from '../orgs/org-members.js';
9
+ import { validateUserRequestObj } from './validator.js';
10
+ const userRegistrationRouter = express.Router();
11
+ const insertUser = async (requestObj, connection) => {
12
+ const requiredFields = ['user_email', 'user_mobile_no', 'user_password', 'user_fname', 'user_lname', 'user_is_active'];
13
+ const reqBody = getRequestFromRoute(requestObj, requiredFields);
14
+ const isValid = validateUserRequestObj(reqBody);
15
+ if (isValid !== true) {
16
+ throw getErrorResponseObj(isValid);
17
+ }
18
+ try {
19
+ delete reqBody.user_is_active;
20
+ //encrypting password
21
+ reqBody.user_password_hash = await hashPassword(reqBody.user_password || '');
22
+ delete reqBody.user_password;
23
+ const result = await insertRecords('auth_users_tbl', [reqBody], connection);
24
+ // Here means success
25
+ return result;
26
+ }
27
+ catch (error) {
28
+ // Handle duplicate entry error (MySQL error code: 1062)
29
+ if (error && error.code === 'ER_DUP_ENTRY') {
30
+ throw getErrorResponseObj({
31
+ errorMsg: 'User already exists.',
32
+ solution: 'Please use a different email or contact support if you believe this is an error.',
33
+ }, error);
34
+ }
35
+ throw getErrorResponseObj({
36
+ errorMsg: 'An error occurred while processing your user registration.',
37
+ solution: 'Please try again later or contact support if the issue persists.',
38
+ }, error);
39
+ }
40
+ };
41
+ const processInvitedUsers = async (email, userId, connection) => {
42
+ //now checking this email is exist in our auth_invited_users_tbl table.
43
+ const sql = `SELECT org_id, invited_user_role_id, invited_users_id FROM auth_invited_users_tbl WHERE email = "${email}" AND is_deleted = 0`;
44
+ const invitedUserResult = await executeSql(sql, connection);
45
+ if (invitedUserResult.length <= 0)
46
+ return [];
47
+ const succeeded = [];
48
+ //Add this user in auth_organization_users_tbl
49
+ for (const element of invitedUserResult) {
50
+ const addTeamMembers = {
51
+ org_id: element.org_id,
52
+ included_users: [
53
+ {
54
+ role_id: element.invited_user_role_id,
55
+ user_id: userId,
56
+ user_opinion: INVITATION_ENUMS.INVITED,
57
+ },
58
+ ],
59
+ };
60
+ const registeredUsersResult = await includeUsersInOrg(addTeamMembers, userId, connection, false);
61
+ succeeded.push(registeredUsersResult);
62
+ try {
63
+ await updateRecords('auth_invited_users_tbl', { is_deleted: 1 }, { invited_users_id: element.invited_users_id }, connection);
64
+ }
65
+ catch (error) {
66
+ logger.error('Error occurred while deleting the created user from invited list.', error);
67
+ }
68
+ }
69
+ return succeeded;
70
+ };
71
+ userRegistrationRouter.post('/', async (request, response) => {
72
+ /**
73
+ * Request JSON can contain:
74
+ * {
75
+ * user_email:
76
+ * user_mobile_no:
77
+ * user_password:
78
+ * user_fname:
79
+ * user_lname:
80
+ * otp:
81
+ * }
82
+ */
83
+ const reqBody = request.body;
84
+ if (validateOTP(reqBody.user_email, reqBody.otp) === false) {
85
+ const responseError = getErrorResponseObj({
86
+ errorMsg: 'Invalid OTP.',
87
+ solution: 'Enter correct OTP and try again.',
88
+ });
89
+ sendErrorResponse(response, responseError);
90
+ return;
91
+ }
92
+ await initializeConnection(async (connection) => {
93
+ try {
94
+ // Begin the transaction
95
+ await connection.beginTransaction();
96
+ const insertedUser = await insertUser(reqBody, connection);
97
+ //here means, the user has been inserted successfully.
98
+ const addedOrgMembers = await processInvitedUsers(reqBody.user_email, insertedUser?.insertId, connection);
99
+ // Commit the transaction as everything is successful
100
+ await connection.commit();
101
+ sendSuccessResponse(response, getResponseObj({
102
+ message: 'User registered successfully.',
103
+ insertedUserId: insertedUser?.insertId,
104
+ addedOrgMembers,
105
+ }));
106
+ delete cachedOTPs[reqBody.user_email];
107
+ }
108
+ catch (error) {
109
+ // Rollback the transaction as in this case of error
110
+ await connection.rollback();
111
+ //here, error means always in correct format.
112
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
113
+ errorMsg: 'An error occurred while user registration.',
114
+ solution: 'Please try again later or contact support if the issue persists.',
115
+ });
116
+ }
117
+ });
118
+ });
119
+ export default userRegistrationRouter;
120
+ //# sourceMappingURL=user-registration-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-registration-router.js","sourceRoot":"","sources":["../../../src/routes/authentication/user-registration-router.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,sCAAsC,GACvC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhD,MAAM,UAAU,GAAG,KAAK,EAAE,UAA+B,EAAE,UAAe,EAAE,EAAE;IAC5E,MAAM,cAAc,GAAkB,CAAC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAEtI,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,EAAE,cAAc,CAAgB,CAAC;IAE/E,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC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AY,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAC3D,sDAAsD;YAEtD,MAAM,eAAe,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAE1G,qDAAqD;YACrD,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;YAE1B,mBAAmB,CACjB,QAAQ,EACR,cAAc,CAAC;gBACb,OAAO,EAAE,+BAA+B;gBACxC,cAAc,EAAE,YAAY,EAAE,QAAQ;gBACtC,eAAe;aAChB,CAAC,CACH,CAAC;YAEF,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,oDAAoD;YACpD,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;YAE5B,6CAA6C;YAC7C,sCAAsC,CAAC,QAAQ,EAAE,KAAK,EAAE;gBACtD,QAAQ,EAAE,4CAA4C;gBACtD,QAAQ,EAAE,kEAAkE;aAC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { OrganizationFields, UsersFields } from '../../utils/type.js';
2
+ export declare const validateUserRequestObj: (userReqObj: UsersFields) => true | {
3
+ errorMsg: string;
4
+ solution: string;
5
+ };
6
+ export declare const validateOrgRequestObj: (orgReqObj: OrganizationFields) => true | {
7
+ errorMsg: string;
8
+ solution: string;
9
+ };
10
+ export declare const validatePassword: (password: string) => true | {
11
+ errorMsg: string;
12
+ solution: string;
13
+ };
14
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEtE,eAAO,MAAM,sBAAsB,GAAI,YAAY,WAAW;;;CAiC7D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,kBAAkB;;;CAuBlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM;;;CAgBhD,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { appInfo } from '../../app-config.js';
2
+ import { isEmailValid, isObjectEmpty } from '../../utils/common-utils.js';
3
+ export const validateUserRequestObj = (userReqObj) => {
4
+ // Check if email and password are provided
5
+ if (!userReqObj.user_email || !userReqObj.user_password) {
6
+ return {
7
+ errorMsg: 'Email and Password are both mandatory fields.',
8
+ solution: 'Please provide both email and password to proceed.',
9
+ };
10
+ }
11
+ // Check if the email is valid
12
+ if (isEmailValid(userReqObj.user_email) === false) {
13
+ return {
14
+ errorMsg: 'Email is invalid',
15
+ solution: 'Please enter a valid email address and try again.',
16
+ };
17
+ }
18
+ // Check if either first name or last name is provided
19
+ if (!userReqObj.user_fname || !userReqObj.user_lname) {
20
+ return {
21
+ errorMsg: 'First & Last Name is required.',
22
+ solution: 'Please provide both first and last name to proceed.',
23
+ };
24
+ }
25
+ //Check password
26
+ const passwordValidation = validatePassword(userReqObj.user_password);
27
+ if (passwordValidation !== true) {
28
+ return passwordValidation;
29
+ }
30
+ //All validations passed
31
+ return true;
32
+ };
33
+ export const validateOrgRequestObj = (orgReqObj) => {
34
+ if (isObjectEmpty(orgReqObj)) {
35
+ return {
36
+ errorMsg: `${appInfo.account_type_txt.singular} request params is required.`,
37
+ solution: 'Provide a request params to proceed.',
38
+ };
39
+ }
40
+ if (!orgReqObj.org_name) {
41
+ return {
42
+ errorMsg: `${appInfo.account_type_txt.singular} name is required.`,
43
+ solution: `Please provide an ${appInfo.account_type_txt.singular.toLocaleLowerCase()} name to proceed.`,
44
+ };
45
+ }
46
+ if (!orgReqObj.org_created_by) {
47
+ return {
48
+ errorMsg: `${appInfo.account_type_txt.singular} created by is required.`,
49
+ solution: 'Perform by re-login and try again.',
50
+ };
51
+ }
52
+ return true;
53
+ };
54
+ export const validatePassword = (password) => {
55
+ if (password.length < 8) {
56
+ return {
57
+ errorMsg: 'Password length should be at least 8 characters.',
58
+ solution: 'Please provide a password with at least 8 characters to proceed.',
59
+ };
60
+ }
61
+ if (password.length > 50) {
62
+ return {
63
+ errorMsg: 'Password length should not be more than 50 characters.',
64
+ solution: 'Please provide a password with at most 50 characters to proceed.',
65
+ };
66
+ }
67
+ return true;
68
+ };
69
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/routes/authentication/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAAuB,EAAE,EAAE;IAChE,2CAA2C;IAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QACxD,OAAO;YACL,QAAQ,EAAE,+CAA+C;YACzD,QAAQ,EAAE,oDAAoD;SAC/D,CAAC;IACJ,CAAC;IAED,8BAA8B;IAC9B,IAAI,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,CAAC;QAClD,OAAO;YACL,QAAQ,EAAE,kBAAkB;YAC5B,QAAQ,EAAE,mDAAmD;SAC9D,CAAC;IACJ,CAAC;IAED,sDAAsD;IACtD,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QACrD,OAAO;YACL,QAAQ,EAAE,gCAAgC;YAC1C,QAAQ,EAAE,qDAAqD;SAChE,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,UAAU,CAAC,aAAa,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C;AACd,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const countriesRouter: import("express-serve-static-core").Router;
2
+ export default countriesRouter;
3
+ //# sourceMappingURL=countries-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries-router.d.ts","sourceRoot":"","sources":["../../../src/routes/countries/countries-router.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,eAAe,4CAAmB,CAAC;AAmBzC,eAAe,eAAe,CAAC"}
@@ -0,0 +1,23 @@
1
+ import express from 'express';
2
+ import logger from '../../utils/error-logger.js';
3
+ import { getResponseObj, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom } from '../../utils/response-utils.js';
4
+ import { executeSql, initializeConnection } from '../../utils/sql-helper.js';
5
+ const countriesRouter = express.Router();
6
+ countriesRouter.get('/', (_, response) => {
7
+ initializeConnection(async (connection) => {
8
+ try {
9
+ const sql = `SELECT country_code as countryCode, country_name as countryName FROM c_countries;`;
10
+ const countries = await executeSql(sql, connection);
11
+ sendSuccessResponse(response, getResponseObj({ countries }));
12
+ }
13
+ catch (error) {
14
+ logger.error('Error while fetching countries:', error);
15
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
16
+ errorMsg: 'An error occurred while fetching countries.',
17
+ solution: 'Please try again later or contact support if the issue persists.',
18
+ });
19
+ }
20
+ });
21
+ });
22
+ export default countriesRouter;
23
+ //# sourceMappingURL=countries-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries-router.js","sourceRoot":"","sources":["../../../src/routes/countries/countries-router.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAE7E,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEzC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE;IACvC,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,mFAAmF,CAAC;YAChG,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAEpD,mBAAmB,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACvD,sCAAsC,CAAC,QAAQ,EAAE,KAAK,EAAE;gBACtD,QAAQ,EAAE,6CAA6C;gBACvD,QAAQ,EAAE,kEAAkE;aAC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const setFeatureFlag: (flags: any) => void;
2
+ export declare const getFeatureFlags: () => any;
3
+ declare const featureFlagsRouter: import("express-serve-static-core").Router;
4
+ export default featureFlagsRouter;
5
+ //# sourceMappingURL=feature-flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/routes/feature-flags/feature-flags.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,GAAI,OAAO,GAAG,KAAG,IAE3C,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,GAElC,CAAC;AAEF,QAAA,MAAM,kBAAkB,4CAAmB,CAAC;AAe5C,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import express from 'express';
2
+ import logger from '../../utils/error-logger.js';
3
+ import { getResponseObj, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom } from '../../utils/response-utils.js';
4
+ const featureFlags = {
5
+ ff_enable_paid_subscription: false,
6
+ ff_enable_teams: false,
7
+ };
8
+ export const setFeatureFlag = (flags) => {
9
+ Object.assign(featureFlags, flags);
10
+ };
11
+ export const getFeatureFlags = () => {
12
+ return featureFlags;
13
+ };
14
+ const featureFlagsRouter = express.Router();
15
+ featureFlagsRouter.get('/', async (_, response) => {
16
+ try {
17
+ sendSuccessResponse(response, getResponseObj({ featureFlags }));
18
+ }
19
+ catch (error) {
20
+ logger.error('Error while returning feature flags:', error);
21
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
22
+ errorMsg: 'An error occurred returning feature flags.',
23
+ solution: 'Please try again later or contact support if the issue persists.',
24
+ });
25
+ }
26
+ });
27
+ export default featureFlagsRouter;
28
+ //# sourceMappingURL=feature-flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../../src/routes/feature-flags/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AAE5H,MAAM,YAAY,GAAG;IACnB,2BAA2B,EAAE,KAAK;IAClC,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAU,EAAQ,EAAE;IACjD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAQ,EAAE;IACvC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE5C,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE;IAChD,IAAI,CAAC;QACH,mBAAmB,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAE5D,sCAAsC,CAAC,QAAQ,EAAE,KAAK,EAAE;YACtD,QAAQ,EAAE,4CAA4C;YACtD,QAAQ,EAAE,kEAAkE;SAC7E,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Application } from 'express';
2
+ declare module 'express-serve-static-core' {
3
+ interface Request {
4
+ user?: any;
5
+ }
6
+ }
7
+ declare const routes: (expressApp: Application) => void;
8
+ export default routes;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmC,MAAM,SAAS,CAAC;AAsBvE,OAAO,QAAQ,2BAA2B,CAAC;IACzC,UAAU,OAAO;QACf,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ;CACF;AAoDD,QAAA,MAAM,MAAM,GAAI,YAAY,WAAW,SAsCtC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { appInfo } from '../app-config.js';
2
+ import { verifyToken } from '../utils/common-utils.js';
3
+ import logger from '../utils/error-logger.js';
4
+ import { getErrorResponseObj, sendErrorResponse } from '../utils/response-utils.js';
5
+ import checkSessionRouter from './authentication/check-session.js';
6
+ import loginRouter from './authentication/login-router.js';
7
+ import resetPasswordRouter from './authentication/reset-password.js';
8
+ import sendOTPRouterRouter from './authentication/send-otp-router.js';
9
+ import userProfileRouter from './authentication/user-profile.js';
10
+ import userRegistrationRouter from './authentication/user-registration-router.js';
11
+ import countriesRouter from './countries/countries-router.js';
12
+ import featureFlagsRouter, { getFeatureFlags } from './feature-flags/feature-flags.js';
13
+ import linkMetadataRouter from './link-metadata.js';
14
+ import invitationRouter from './orgs/invitation.js';
15
+ import orgMembersRouter from './orgs/org-members.js';
16
+ import orgRegistrationRouter from './orgs/org-registration-router.js';
17
+ import getSubscriptionConfigRouter from './paid-plans/get-subscription-config.js';
18
+ import paymentGateWayRouter from './paid-plans/payment-gateway.js';
19
+ import purchasedPlansRouter from './paid-plans/purchased-plans.js';
20
+ const middleWare = async (request, response, next) => {
21
+ const api = (request.headers.api || '').toString();
22
+ let userObj = null;
23
+ try {
24
+ if (!api) {
25
+ throw 'API_EMPTY';
26
+ }
27
+ userObj = verifyToken(api);
28
+ if (!userObj) {
29
+ //Pass error object
30
+ throw 'UNAUTH';
31
+ } //if..
32
+ //Here means session exists, this userObj contains { id and email }
33
+ request.user = userObj;
34
+ next();
35
+ }
36
+ catch (error) {
37
+ let commonError = getErrorResponseObj({
38
+ errorMsg: 'An uncaught error occurred!',
39
+ solution: 'Please log in and try again.',
40
+ }, error);
41
+ if (error === 'API_EMPTY') {
42
+ commonError = getErrorResponseObj({
43
+ errorMsg: 'You are not logged in.',
44
+ solution: 'Please log in and try again.',
45
+ });
46
+ }
47
+ else if (error === 'UNAUTH') {
48
+ commonError = getErrorResponseObj({
49
+ errorMsg: 'You have been logged out because your session has expired.',
50
+ solution: 'Please log in and try again.',
51
+ }, error);
52
+ }
53
+ else {
54
+ logger.error('An uncaught error occurred', error);
55
+ }
56
+ sendErrorResponse(response, commonError);
57
+ }
58
+ };
59
+ const routes = (expressApp) => {
60
+ expressApp.get('/', (_, response) => {
61
+ response.json({
62
+ title: `${appInfo.appName} API Portal`,
63
+ message: `Welcome to the ${appInfo.appName} API portal!`,
64
+ });
65
+ });
66
+ //login does not requires for below APIs
67
+ expressApp.use('/send-otp', sendOTPRouterRouter);
68
+ expressApp.use('/user-registration', userRegistrationRouter);
69
+ expressApp.use('/login', loginRouter);
70
+ expressApp.use('/reset-password', resetPasswordRouter);
71
+ if (getFeatureFlags().ff_enable_paid_subscription) {
72
+ expressApp.use('/get-subscription-config', getSubscriptionConfigRouter);
73
+ }
74
+ expressApp.use('/feature-flags', featureFlagsRouter);
75
+ expressApp.use(middleWare);
76
+ //login required for below APIs
77
+ expressApp.use('/check-session', checkSessionRouter);
78
+ if (getFeatureFlags().ff_enable_teams) {
79
+ expressApp.use('/organization', orgRegistrationRouter);
80
+ expressApp.use('/invitation', invitationRouter);
81
+ expressApp.use('/org-member', orgMembersRouter);
82
+ }
83
+ expressApp.use('/get-countries', countriesRouter);
84
+ expressApp.use('/user-profile', userProfileRouter);
85
+ expressApp.use('/link-metadata', linkMetadataRouter);
86
+ if (getFeatureFlags().ff_enable_paid_subscription) {
87
+ expressApp.use('/payment-gateway', paymentGateWayRouter);
88
+ expressApp.use('/purchased-plans', purchasedPlansRouter);
89
+ }
90
+ };
91
+ export default routes;
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AACnE,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AACtE,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,sBAAsB,MAAM,8CAA8C,CAAC;AAClF,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,kBAAkB,EAAE,EAAE,eAAe,E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U,CAAC,GAAG,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;QACvD,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;QAChD,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAC,GAAG,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAClD,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACnD,UAAU,CAAC,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;IAErD,IAAI,eAAe,EAAE,CAAC,2BAA2B,EAAE,CAAC;QAClD,UAAU,CAAC,GAAG,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;QACzD,UAAU,CAAC,GAAG,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const linkMetadataRouter: import("express-serve-static-core").Router;
2
+ export default linkMetadataRouter;
3
+ //# sourceMappingURL=link-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-metadata.d.ts","sourceRoot":"","sources":["../../src/routes/link-metadata.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,kBAAkB,4CAAmB,CAAC;AAgC5C,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import express from 'express';
2
+ import axios from 'axios';
3
+ import { getResponseObj, sendSuccessResponse } from '../utils/response-utils.js';
4
+ import { getSecretValue } from '../secret.js';
5
+ import logger from '../utils/error-logger.js';
6
+ const linkMetadataRouter = express.Router();
7
+ linkMetadataRouter.get('/', async (req, res) => {
8
+ const url = req.query.url;
9
+ if (!url) {
10
+ res.status(400).json({ error: 'URL is required' });
11
+ return;
12
+ }
13
+ try {
14
+ // Fetch the page content
15
+ const apiKey = getSecretValue('linkPreviewApiKey');
16
+ const { data } = await axios.get('https://api.linkpreview.net', {
17
+ params: {
18
+ key: apiKey,
19
+ q: url,
20
+ },
21
+ timeout: 5000,
22
+ });
23
+ const title = data.title;
24
+ const description = data.description;
25
+ const image = data.image;
26
+ sendSuccessResponse(res, getResponseObj({ title, description, image }));
27
+ }
28
+ catch (error) {
29
+ logger.error('Error fetching link metadata:', error);
30
+ sendSuccessResponse(res, getResponseObj({ title: url, description: '', image: '' }));
31
+ }
32
+ });
33
+ export default linkMetadataRouter;
34
+ //# sourceMappingURL=link-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-metadata.js","sourceRoot":"","sources":["../../src/routes/link-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAE9C,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE5C,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IAChE,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAa,CAAC;IAEpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,yBAAyB;QACzB,MAAM,MAAM,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,6BAA6B,EAAE;YAC9D,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM;gBACX,CAAC,EAAE,GAAG;aACP;YACD,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACrD,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvF,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getOrgUserRecord, getOrgCreatedBy, isOrgUserActive } from './org-utils.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/orgs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { getOrgUserRecord, getOrgCreatedBy, isOrgUserActive } from './org-utils.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/orgs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const invitationRouter: import("express-serve-static-core").Router;
2
+ export default invitationRouter;
3
+ //# sourceMappingURL=invitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../../src/routes/orgs/invitation.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,gBAAgB,4CAAmB,CAAC;AA2G1C,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,103 @@
1
+ import express from 'express';
2
+ import { appInfo } from '../../app-config.js';
3
+ import { isValidId } from '../../utils/common-utils.js';
4
+ import { INVITATION_ENUMS } from '../../utils/enums.js';
5
+ import { getErrorResponseObj, getResponseObj, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom } from '../../utils/response-utils.js';
6
+ import { executeSql, initializeConnection, updateRecords } from '../../utils/sql-helper.js';
7
+ import { getOrgCreatedBy, invalidateOrgUserCacheForUser } from './org-utils.js';
8
+ const invitationRouter = express.Router();
9
+ //here, these routes means, user is registered amd they can approve/deny the invitation.
10
+ invitationRouter.get('/', async (request, response) => {
11
+ const loggedInUserId = request.user?.id;
12
+ await initializeConnection(async (connection) => {
13
+ try {
14
+ if (!isValidId(loggedInUserId)) {
15
+ throw getErrorResponseObj({
16
+ errorMsg: 'Cannot retrieve invitations, invalid logged-in user.',
17
+ solution: 'Please re-login and try again.',
18
+ });
19
+ }
20
+ const sql = `SELECT o.org_name, o.org_id, ou.org_user_role_id as role_id, ou.org_user_is_active, ou.updated_at as sent_at
21
+ FROM auth_organization_users_tbl ou INNER JOIN auth_organization_tbl o ON ou.org_id = o.org_id
22
+ WHERE ou.user_id = ${loggedInUserId} AND ou.user_opinion = ${INVITATION_ENUMS.INVITED} AND ou.org_user_is_active = 1`;
23
+ const invites = await executeSql(sql, connection);
24
+ sendSuccessResponse(response, getResponseObj({ invites }));
25
+ }
26
+ catch (error) {
27
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
28
+ errorMsg: 'Error occurred while adding retrieving invitations.',
29
+ solution: 'Please try again later or contact support if the issue persists.',
30
+ });
31
+ }
32
+ });
33
+ });
34
+ invitationRouter.put('/', async (request, response) => {
35
+ /**
36
+ * You can use this API to ACCEPT, REJECT or LEFT any org.
37
+ * Req JSON: {
38
+ * org_id: number,
39
+ * user_opinion: type of INVITATION_ENUMS
40
+ * }
41
+ */
42
+ const loggedInUserId = request.user?.id;
43
+ const { org_id, user_opinion } = request.body;
44
+ const userOpinion = parseInt(user_opinion, 10);
45
+ const isAccept = userOpinion === INVITATION_ENUMS.ACCEPTED;
46
+ await initializeConnection(async (connection) => {
47
+ try {
48
+ if (!isValidId(loggedInUserId)) {
49
+ throw getErrorResponseObj({
50
+ errorMsg: `Cannot ${isAccept ? 'accept' : 'reject'} the invitation, invalid logged-in user.`,
51
+ solution: 'Please re-login and try again.',
52
+ });
53
+ }
54
+ else if (!isValidId(org_id)) {
55
+ throw getErrorResponseObj({
56
+ errorMsg: `Cannot ${isAccept ? 'accept' : 'reject'} the invitation, invalid ${appInfo.account_type_txt.singular.toLocaleLowerCase()} details user.`,
57
+ solution: 'org_id is missing in request json.',
58
+ });
59
+ }
60
+ else if (userOpinion !== INVITATION_ENUMS.ACCEPTED && userOpinion !== INVITATION_ENUMS.REJECTED && userOpinion !== INVITATION_ENUMS.LEFT) {
61
+ throw getErrorResponseObj({
62
+ errorMsg: `Invalid option selected please either select approve or reject or left to continue.`,
63
+ solution: 'org_id is missing in request json.',
64
+ });
65
+ }
66
+ if (!isAccept) {
67
+ const orgCreatedBy = await getOrgCreatedBy(org_id, connection);
68
+ if (orgCreatedBy === loggedInUserId) {
69
+ throw getErrorResponseObj({
70
+ errorMsg: `As you are the creator of this ${appInfo.account_type_txt.singular.toLocaleLowerCase()}, you cannot leave this ${appInfo.account_type_txt.singular.toLocaleLowerCase()}.`,
71
+ solution: `If you want to delete this ${appInfo.account_type_txt.singular.toLocaleLowerCase()}, please use the delete option instead.`,
72
+ });
73
+ }
74
+ }
75
+ const updateData = {
76
+ user_opinion: userOpinion,
77
+ };
78
+ const whereClause = {
79
+ org_id,
80
+ user_id: loggedInUserId,
81
+ };
82
+ const responseObj = await updateRecords('auth_organization_users_tbl', updateData, whereClause, connection);
83
+ const success = responseObj.affectedRows > 0;
84
+ await invalidateOrgUserCacheForUser(whereClause.org_id, whereClause.user_id);
85
+ if (success) {
86
+ sendSuccessResponse(response, getResponseObj({ ...updateData, ...whereClause }));
87
+ return;
88
+ }
89
+ throw getErrorResponseObj({
90
+ errorMsg: `Error occurred while ${isAccept ? 'accepting' : 'rejecting'} an invitation.`,
91
+ solution: 'Please try again later or contact support if the issue persists.',
92
+ });
93
+ }
94
+ catch (error) {
95
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
96
+ errorMsg: `Error occurred while ${isAccept ? 'accepting' : 'rejecting'} an invitation.`,
97
+ solution: 'Please try again later or contact support if the issue persists.',
98
+ });
99
+ }
100
+ });
101
+ });
102
+ export default invitationRouter;
103
+ //# sourceMappingURL=invitation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitation.js","sourceRoot":"","sources":["../../../src/routes/orgs/invitation.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AACjJ,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAEhF,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE1C,wFAAwF;AAExF,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAgB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BACvI,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,MAAM,UAAU,GAAG;gBACjB,YAAY,EAAE,WAAW;aAC1B,CAAC;YAEF,MAAM,WAAW,GAAG;gBAClB,MAAM;gBACN,OAAO,EAAE,cAAc;aACxB,CAAC;YAEF,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,6BAA6B,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;YAC5G,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,GAAG,CAAC,CAAC;YAC7C,MAAM,6BAA6B,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAE7E,IAAI,OAAO,EAAE,CAAC;gBACZ,mBAAmB,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC;gBACjF,OAAO;YACT,CAAC;YAED,MAAM,mBAAmB,CAAC;gBACxB,QAAQ,EAAE,wBAAwB,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,iBAAiB;gBACvF,QAAQ,EAAE,kEAAkE;aAC7E,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,sCAAsC,CAAC,QAAQ,EAAE,KAAK,EAAE;gBACtD,QAAQ,EAAE,wBAAwB,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,iBAAiB;gBACvF,QAAQ,EAAE,kEAAkE;aAC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from 'express';
2
+ export declare const deleteOrg: (request: Request, response: Response) => Promise<void>;
3
+ //# sourceMappingURL=org-delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-delete.d.ts","sourceRoot":"","sources":["../../../src/routes/orgs/org-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAa5C,eAAO,MAAM,SAAS,GAAU,SAAS,OAAO,EAAE,UAAU,QAAQ,kBAgEnE,CAAC"}