@kipicore/dbcore 1.1.687 → 1.1.688

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/dist/configs/env.d.ts +0 -2
  2. package/dist/configs/env.js +0 -4
  3. package/dist/configs/index.d.ts +0 -2
  4. package/dist/configs/index.js +0 -2
  5. package/dist/constants/app.d.ts +29 -27
  6. package/dist/constants/app.js +39 -37
  7. package/dist/constants/errorMessages.d.ts +1 -20
  8. package/dist/constants/errorMessages.js +1 -22
  9. package/dist/constants/successMessages.d.ts +0 -14
  10. package/dist/constants/successMessages.js +1 -17
  11. package/dist/db/psql/migrations/20260714095754-create-arena-models.js +642 -0
  12. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +2 -0
  13. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +138 -0
  14. package/dist/db/psql/migrations/20260722143500-create-school_has_sports.js +71 -0
  15. package/dist/db/psql/migrations/20260728170500-add_sports_academy_id_to_testimonials.js +21 -0
  16. package/dist/helpers/index.d.ts +0 -3
  17. package/dist/helpers/index.js +0 -3
  18. package/dist/helpers/utils.d.ts +3 -5
  19. package/dist/helpers/utils.js +31 -58
  20. package/dist/index.d.ts +0 -4
  21. package/dist/index.js +0 -4
  22. package/dist/interfaces/ageGroupInterface.d.ts +12 -0
  23. package/dist/interfaces/amenityInterface.d.ts +23 -0
  24. package/dist/interfaces/assessmentTestInterface.d.ts +23 -0
  25. package/dist/interfaces/assessmentTestInterface.js +2 -0
  26. package/dist/interfaces/categoriesInterface.d.ts +1 -2
  27. package/dist/interfaces/equipmentInterface.d.ts +10 -0
  28. package/dist/interfaces/equipmentInterface.js +2 -0
  29. package/dist/interfaces/facilityMasterInterface.d.ts +9 -0
  30. package/dist/interfaces/facilityMasterInterface.js +2 -0
  31. package/dist/interfaces/index.d.ts +17 -1
  32. package/dist/interfaces/index.js +18 -1
  33. package/dist/interfaces/instituteInterface.d.ts +0 -1
  34. package/dist/interfaces/instituteOwnershipHistoryInterface.d.ts +1 -2
  35. package/dist/interfaces/institutePartnersInterface.d.ts +1 -2
  36. package/dist/interfaces/photosGalleryInterface.d.ts +3 -1
  37. package/dist/interfaces/schoolHasSportInterface.d.ts +7 -0
  38. package/dist/interfaces/schoolHasSportInterface.js +2 -0
  39. package/dist/interfaces/skillInterface.d.ts +19 -0
  40. package/dist/interfaces/skillInterface.js +2 -0
  41. package/dist/interfaces/sportCategoryInterface.d.ts +9 -0
  42. package/dist/interfaces/sportCategoryInterface.js +2 -0
  43. package/dist/interfaces/sportGroupDataInterface.d.ts +7 -0
  44. package/dist/interfaces/sportGroupDataInterface.js +2 -0
  45. package/dist/interfaces/sportInfoInterface.d.ts +23 -0
  46. package/dist/interfaces/sportInfoInterface.js +2 -0
  47. package/dist/interfaces/sportInterface.d.ts +10 -0
  48. package/dist/interfaces/sportInterface.js +2 -0
  49. package/dist/interfaces/sportRoleInterface.d.ts +11 -0
  50. package/dist/interfaces/sportRoleInterface.js +2 -0
  51. package/dist/interfaces/sportSubCategoryInterface.d.ts +10 -0
  52. package/dist/interfaces/sportSubCategoryInterface.js +2 -0
  53. package/dist/interfaces/sportsAcademyInterface.d.ts +39 -0
  54. package/dist/interfaces/sportsAcademyInterface.js +2 -0
  55. package/dist/interfaces/studentSportTestInterface.d.ts +20 -0
  56. package/dist/interfaces/studentSportTestInterface.js +2 -0
  57. package/dist/interfaces/subCategoriesInterface.d.ts +1 -2
  58. package/dist/interfaces/subscriptionPlanInterface.d.ts +1 -2
  59. package/dist/interfaces/testimonialInterface.d.ts +1 -0
  60. package/dist/interfaces/unitInterface.d.ts +10 -0
  61. package/dist/interfaces/unitInterface.js +2 -0
  62. package/dist/interfaces/userAcademyMetaInterface.d.ts +18 -0
  63. package/dist/interfaces/userAcademyMetaInterface.js +2 -0
  64. package/dist/interfaces/userAmenityInterface.d.ts +23 -0
  65. package/dist/interfaces/userAmenityInterface.js +2 -0
  66. package/dist/interfaces/userInterface.d.ts +1 -3
  67. package/dist/interfaces/vendorCompanyMetaInterface.d.ts +2 -5
  68. package/dist/models/mongodb/amenityModel.d.ts +4 -0
  69. package/dist/models/mongodb/amenityModel.js +72 -0
  70. package/dist/models/mongodb/assessmentTestModel.d.ts +4 -0
  71. package/dist/models/mongodb/assessmentTestModel.js +72 -0
  72. package/dist/models/mongodb/index.d.ts +6 -0
  73. package/dist/models/mongodb/index.js +14 -1
  74. package/dist/models/mongodb/photosGalleryModel.js +5 -1
  75. package/dist/models/mongodb/productMetaModel.js +1 -9
  76. package/dist/models/mongodb/sportInfoModel.d.ts +4 -0
  77. package/dist/models/mongodb/sportInfoModel.js +71 -0
  78. package/dist/models/mongodb/sportsAcademyModel.d.ts +4 -0
  79. package/dist/models/mongodb/sportsAcademyModel.js +89 -0
  80. package/dist/models/mongodb/studentSportTestModel.d.ts +4 -0
  81. package/dist/models/mongodb/studentSportTestModel.js +68 -0
  82. package/dist/models/mongodb/subscriptionPlanModel.js +0 -5
  83. package/dist/models/mongodb/userAcademyMetaModel.d.ts +4 -0
  84. package/dist/models/mongodb/userAcademyMetaModel.js +113 -0
  85. package/dist/models/mongodb/userAmenityModel.d.ts +4 -0
  86. package/dist/models/mongodb/userAmenityModel.js +72 -0
  87. package/dist/models/mongodb/vendorCompanyMetaModel.js +1 -15
  88. package/dist/models/psql/SubCategoriesModel.d.ts +1 -2
  89. package/dist/models/psql/SubCategoriesModel.js +0 -5
  90. package/dist/models/psql/ageGroupModel.d.ts +22 -0
  91. package/dist/models/psql/ageGroupModel.js +76 -0
  92. package/dist/models/psql/categoriesModel.d.ts +1 -2
  93. package/dist/models/psql/categoriesModel.js +0 -5
  94. package/dist/models/psql/equipmentModel.d.ts +20 -0
  95. package/dist/models/psql/equipmentModel.js +57 -0
  96. package/dist/models/psql/facilityMasterModel.d.ts +18 -0
  97. package/dist/models/psql/facilityMasterModel.js +64 -0
  98. package/dist/models/psql/fileStorageModel.js +4 -3
  99. package/dist/models/psql/index.d.ts +11 -1
  100. package/dist/models/psql/index.js +25 -4
  101. package/dist/models/psql/instituteModel.d.ts +0 -1
  102. package/dist/models/psql/instituteModel.js +2 -5
  103. package/dist/models/psql/instituteOwnershipHistoryModel.d.ts +1 -2
  104. package/dist/models/psql/instituteOwnershipHistoryModel.js +3 -8
  105. package/dist/models/psql/institutePartnersModel.d.ts +1 -2
  106. package/dist/models/psql/institutePartnersModel.js +3 -8
  107. package/dist/models/psql/schoolHasSportModel.d.ts +17 -0
  108. package/dist/models/psql/schoolHasSportModel.js +76 -0
  109. package/dist/models/psql/skillModel.d.ts +25 -0
  110. package/dist/models/psql/skillModel.js +99 -0
  111. package/dist/models/psql/sportCategoryModel.d.ts +19 -0
  112. package/dist/models/psql/sportCategoryModel.js +53 -0
  113. package/dist/models/psql/sportGroupDataModel.d.ts +13 -0
  114. package/dist/models/psql/sportGroupDataModel.js +64 -0
  115. package/dist/models/psql/sportModel.d.ts +20 -0
  116. package/dist/models/psql/sportModel.js +58 -0
  117. package/dist/models/psql/sportRoleModel.d.ts +21 -0
  118. package/dist/models/psql/sportRoleModel.js +71 -0
  119. package/dist/models/psql/sportSubCategoryModel.d.ts +20 -0
  120. package/dist/models/psql/sportSubCategoryModel.js +75 -0
  121. package/dist/models/psql/testimonialModel.d.ts +1 -0
  122. package/dist/models/psql/testimonialModel.js +8 -7
  123. package/dist/models/psql/unitModel.d.ts +20 -0
  124. package/dist/models/psql/unitModel.js +57 -0
  125. package/dist/models/psql/userModel.d.ts +1 -3
  126. package/dist/models/psql/userModel.js +2 -2
  127. package/dist/types/ageGroupType.d.ts +2 -0
  128. package/dist/types/ageGroupType.js +2 -0
  129. package/dist/types/assessmentTestType.d.ts +2 -0
  130. package/dist/types/assessmentTestType.js +2 -0
  131. package/dist/types/commonType.d.ts +1 -29
  132. package/dist/types/equipmentType.d.ts +2 -0
  133. package/dist/types/equipmentType.js +2 -0
  134. package/dist/types/facilityMasterType.d.ts +3 -0
  135. package/dist/types/facilityMasterType.js +2 -0
  136. package/dist/types/index.d.ts +17 -1
  137. package/dist/types/index.js +18 -1
  138. package/dist/types/schoolHasSportType.d.ts +2 -0
  139. package/dist/types/schoolHasSportType.js +2 -0
  140. package/dist/types/skillType.d.ts +2 -0
  141. package/dist/types/skillType.js +2 -0
  142. package/dist/types/sportCategoryType.d.ts +2 -0
  143. package/dist/types/sportCategoryType.js +2 -0
  144. package/dist/types/sportGroupDataType.d.ts +3 -0
  145. package/dist/types/sportGroupDataType.js +2 -0
  146. package/dist/types/sportInfoType.d.ts +2 -0
  147. package/dist/types/sportInfoType.js +2 -0
  148. package/dist/types/sportRoleType.d.ts +2 -0
  149. package/dist/types/sportRoleType.js +2 -0
  150. package/dist/types/sportSubCategoryType.d.ts +2 -0
  151. package/dist/types/sportSubCategoryType.js +2 -0
  152. package/dist/types/sportType.d.ts +2 -0
  153. package/dist/types/sportType.js +2 -0
  154. package/dist/types/sportsAcademyType.d.ts +2 -0
  155. package/dist/types/sportsAcademyType.js +2 -0
  156. package/dist/types/studentSportTestType.d.ts +2 -0
  157. package/dist/types/studentSportTestType.js +2 -0
  158. package/dist/types/unitType.d.ts +2 -0
  159. package/dist/types/unitType.js +2 -0
  160. package/dist/types/userAcademyMetaType.d.ts +2 -0
  161. package/dist/types/userAcademyMetaType.js +2 -0
  162. package/dist/types/userAmenityType.d.ts +2 -0
  163. package/dist/types/userAmenityType.js +2 -0
  164. package/package.json +2 -10
  165. package/dist/commonValidator/commandValidator.d.ts +0 -27
  166. package/dist/commonValidator/commandValidator.js +0 -225
  167. package/dist/commonValidator/index.d.ts +0 -3
  168. package/dist/commonValidator/index.js +0 -24
  169. package/dist/commonValidator/joiCommonValidator.d.ts +0 -12
  170. package/dist/commonValidator/joiCommonValidator.js +0 -47
  171. package/dist/commonValidator/joiSchemaBuilder.d.ts +0 -6
  172. package/dist/commonValidator/joiSchemaBuilder.js +0 -70
  173. package/dist/configs/logger.d.ts +0 -2
  174. package/dist/configs/logger.js +0 -44
  175. package/dist/configs/redisConfig.d.ts +0 -4
  176. package/dist/configs/redisConfig.js +0 -32
  177. package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +0 -46
  178. package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +0 -20
  179. package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +0 -156
  180. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +0 -2
  181. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +0 -19
  182. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +0 -2
  183. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +0 -19
  184. package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +0 -2
  185. package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +0 -19
  186. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.d.ts +0 -2
  187. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js +0 -12
  188. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +0 -2
  189. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +0 -42
  190. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.d.ts +0 -2
  191. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.js +0 -22
  192. package/dist/db/psql/migrations/20260727123149-add_vendorCompanyId_to_institute_ownership_histories.d.ts +0 -2
  193. package/dist/db/psql/migrations/20260727123149-add_vendorCompanyId_to_institute_ownership_histories.js +0 -23
  194. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.d.ts +0 -2
  195. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.js +0 -23
  196. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.d.ts +0 -2
  197. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.js +0 -28
  198. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.d.ts +0 -2
  199. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.js +0 -25
  200. package/dist/helpers/sendEmail.d.ts +0 -3
  201. package/dist/helpers/sendEmail.js +0 -117
  202. package/dist/helpers/sendNotification.d.ts +0 -4
  203. package/dist/helpers/sendNotification.js +0 -34
  204. package/dist/helpers/sendSMS.d.ts +0 -5
  205. package/dist/helpers/sendSMS.js +0 -34
  206. package/dist/interfaces/aiModelKeysInterface.d.ts +0 -15
  207. package/dist/models/psql/aiModelKeysModel.d.ts +0 -20
  208. package/dist/models/psql/aiModelKeysModel.js +0 -70
  209. package/dist/queues/emailQueue.d.ts +0 -3
  210. package/dist/queues/emailQueue.js +0 -22
  211. package/dist/queues/emailWorker.d.ts +0 -3
  212. package/dist/queues/emailWorker.js +0 -33
  213. package/dist/queues/index.d.ts +0 -2
  214. package/dist/queues/index.js +0 -18
  215. package/dist/types/aiModelKeysType.d.ts +0 -3
  216. /package/dist/db/psql/migrations/{20260714111425-change_status_enum_to_string_in_institutes.d.ts → 20260714095754-create-arena-models.d.ts} +0 -0
  217. /package/dist/db/psql/migrations/{20260714131500-add_note_to_institutes.d.ts → 20260722143500-create-school_has_sports.d.ts} +0 -0
  218. /package/dist/db/psql/migrations/{20260715150000-create-ai-model-keys.d.ts → 20260728170500-add_sports_academy_id_to_testimonials.d.ts} +0 -0
  219. /package/dist/interfaces/{aiModelKeysInterface.js → ageGroupInterface.js} +0 -0
  220. /package/dist/{types/aiModelKeysType.js → interfaces/amenityInterface.js} +0 -0
@@ -1,156 +0,0 @@
1
- "use strict";
2
- const up = async (queryInterface, Sequelize) => {
3
- const tableName = 'ai_model_keys';
4
- const tableExists = await queryInterface
5
- .describeTable(tableName)
6
- .then(() => true)
7
- .catch(() => false);
8
- if (!tableExists) {
9
- await queryInterface.createTable(tableName, {
10
- id: {
11
- type: Sequelize.UUID,
12
- defaultValue: Sequelize.UUIDV4,
13
- allowNull: false,
14
- primaryKey: true,
15
- },
16
- key: {
17
- type: Sequelize.STRING,
18
- allowNull: false,
19
- unique: true,
20
- },
21
- hasValue: {
22
- type: Sequelize.STRING,
23
- allowNull: false,
24
- field: 'has_value',
25
- },
26
- type: {
27
- type: Sequelize.STRING,
28
- allowNull: false,
29
- },
30
- description: {
31
- type: Sequelize.TEXT,
32
- allowNull: false,
33
- },
34
- version: {
35
- type: Sequelize.INTEGER,
36
- allowNull: false,
37
- defaultValue: 1,
38
- },
39
- createdBy: {
40
- type: Sequelize.UUID,
41
- allowNull: true,
42
- field: 'created_by',
43
- },
44
- updatedBy: {
45
- type: Sequelize.UUID,
46
- allowNull: true,
47
- field: 'updated_by',
48
- },
49
- deletedBy: {
50
- type: Sequelize.UUID,
51
- allowNull: true,
52
- field: 'deleted_by',
53
- },
54
- createdAt: {
55
- type: Sequelize.DATE,
56
- allowNull: false,
57
- field: 'created_at',
58
- },
59
- updatedAt: {
60
- type: Sequelize.DATE,
61
- allowNull: false,
62
- field: 'updated_at',
63
- },
64
- deletedAt: {
65
- type: Sequelize.DATE,
66
- allowNull: true,
67
- field: 'deleted_at',
68
- },
69
- });
70
- }
71
- else {
72
- const tableDefinition = await queryInterface.describeTable(tableName);
73
- const columnsToAdd = {
74
- id: {
75
- type: Sequelize.UUID,
76
- defaultValue: Sequelize.UUIDV4,
77
- allowNull: false,
78
- primaryKey: true,
79
- },
80
- key: {
81
- type: Sequelize.STRING,
82
- allowNull: false,
83
- unique: true,
84
- },
85
- hasValue: {
86
- type: Sequelize.STRING,
87
- allowNull: false,
88
- field: 'has_value',
89
- },
90
- type: {
91
- type: Sequelize.STRING,
92
- allowNull: false,
93
- },
94
- description: {
95
- type: Sequelize.TEXT,
96
- allowNull: false,
97
- },
98
- version: {
99
- type: Sequelize.INTEGER,
100
- allowNull: false,
101
- defaultValue: 1,
102
- },
103
- createdBy: {
104
- type: Sequelize.UUID,
105
- allowNull: true,
106
- field: 'created_by',
107
- },
108
- updatedBy: {
109
- type: Sequelize.UUID,
110
- allowNull: true,
111
- field: 'updated_by',
112
- },
113
- deletedBy: {
114
- type: Sequelize.UUID,
115
- allowNull: true,
116
- field: 'deleted_by',
117
- },
118
- createdAt: {
119
- type: Sequelize.DATE,
120
- allowNull: false,
121
- field: 'created_at',
122
- },
123
- updatedAt: {
124
- type: Sequelize.DATE,
125
- allowNull: false,
126
- field: 'updated_at',
127
- },
128
- deletedAt: {
129
- type: Sequelize.DATE,
130
- allowNull: true,
131
- field: 'deleted_at',
132
- },
133
- };
134
- for (const column of Object.keys(columnsToAdd)) {
135
- const columnToAdd = columnsToAdd[column];
136
- const tableColumn = columnToAdd.field || column;
137
- if (!tableDefinition[tableColumn]) {
138
- await queryInterface.addColumn(tableName, tableColumn, columnToAdd);
139
- }
140
- }
141
- }
142
- };
143
- const down = async (queryInterface) => {
144
- const tableName = 'ai_model_keys';
145
- const tableExists = await queryInterface
146
- .describeTable(tableName)
147
- .then(() => true)
148
- .catch(() => false);
149
- if (tableExists) {
150
- await queryInterface.dropTable(tableName);
151
- }
152
- };
153
- module.exports = {
154
- up,
155
- down,
156
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('categories');
5
- if (!table.type) {
6
- await queryInterface.addColumn('categories', 'type', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'INVENTORY',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('categories');
15
- if (table.type) {
16
- await queryInterface.removeColumn('categories', 'type');
17
- }
18
- }
19
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('sub_categories');
5
- if (!table.type) {
6
- await queryInterface.addColumn('sub_categories', 'type', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'INVENTORY',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('sub_categories');
15
- if (table.type) {
16
- await queryInterface.removeColumn('sub_categories', 'type');
17
- }
18
- }
19
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('users');
5
- if (!table.status) {
6
- await queryInterface.addColumn('users', 'status', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'ACTIVE',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('users');
15
- if (table.status) {
16
- await queryInterface.removeColumn('users', 'status');
17
- }
18
- }
19
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,12 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- await queryInterface.addColumn('rms_maintenance_activities', 'deleted_at', {
5
- type: Sequelize.DATE,
6
- allowNull: true,
7
- });
8
- },
9
- down: async (queryInterface, Sequelize) => {
10
- await queryInterface.removeColumn('rms_maintenance_activities', 'deleted_at');
11
- }
12
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,42 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('file_storage');
5
- if (table.uploaded_from) {
6
- // In PostgreSQL, changing from ENUM to VARCHAR requires a USING clause
7
- try {
8
- await queryInterface.sequelize.query('ALTER TABLE file_storage ALTER COLUMN uploaded_from TYPE VARCHAR(255) USING uploaded_from::varchar;');
9
- await queryInterface.changeColumn('file_storage', 'uploaded_from', {
10
- type: Sequelize.STRING,
11
- allowNull: true,
12
- });
13
- }
14
- catch (error) {
15
- // Fallback if the raw query fails
16
- await queryInterface.changeColumn('file_storage', 'uploaded_from', {
17
- type: Sequelize.STRING,
18
- allowNull: true,
19
- });
20
- }
21
- }
22
- },
23
- down: async (queryInterface, Sequelize) => {
24
- const table = await queryInterface.describeTable('file_storage');
25
- if (table.uploaded_from) {
26
- try {
27
- await queryInterface.sequelize.query('ALTER TABLE file_storage ALTER COLUMN uploaded_from TYPE "enum_file_storage_uploaded_from" USING uploaded_from::text::"enum_file_storage_uploaded_from";');
28
- await queryInterface.changeColumn('file_storage', 'uploaded_from', {
29
- type: Sequelize.ENUM('INSTITUTE_APP', 'SCHOOL_APP', 'GLOBAL_APP', 'STUDENT_APP', 'VENDOR_APP'),
30
- allowNull: false,
31
- });
32
- }
33
- catch (error) {
34
- // Fallback
35
- await queryInterface.changeColumn('file_storage', 'uploaded_from', {
36
- type: Sequelize.ENUM('INSTITUTE_APP', 'SCHOOL_APP', 'GLOBAL_APP', 'STUDENT_APP', 'VENDOR_APP'),
37
- allowNull: false,
38
- });
39
- }
40
- }
41
- }
42
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,22 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('users');
4
- if (!table.portfolio_theme) {
5
- await queryInterface.addColumn('users', 'portfolio_theme', {
6
- type: Sequelize.STRING,
7
- defaultValue: null,
8
- allowNull: true,
9
- field: 'portfolio_theme',
10
- });
11
- }
12
- };
13
- const down = async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('users');
15
- if (table.portfolio_theme) {
16
- await queryInterface.removeColumn('users', 'portfolio_theme');
17
- }
18
- };
19
- module.exports = {
20
- up,
21
- down,
22
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any): Promise<void>;
@@ -1,23 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('institute_ownership_histories');
4
- // Check if column already exists
5
- if (!table.vendor_company_id) {
6
- await queryInterface.addColumn('institute_ownership_histories', 'vendor_company_id', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- field: 'vendor_company_id',
10
- });
11
- }
12
- };
13
- const down = async (queryInterface) => {
14
- const table = await queryInterface.describeTable('institute_ownership_histories');
15
- // Remove only if column exists
16
- if (table.vendor_company_id) {
17
- await queryInterface.removeColumn('institute_ownership_histories', 'vendor_company_id');
18
- }
19
- };
20
- module.exports = {
21
- up,
22
- down,
23
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any): Promise<void>;
@@ -1,23 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('institute_partners');
4
- // Check if column already exists
5
- if (!table.vendor_company_id) {
6
- await queryInterface.addColumn('institute_partners', 'vendor_company_id', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- field: 'vendor_company_id',
10
- });
11
- }
12
- };
13
- const down = async (queryInterface) => {
14
- const table = await queryInterface.describeTable('institute_partners');
15
- // Remove only if column exists
16
- if (table.vendor_company_id) {
17
- await queryInterface.removeColumn('institute_partners', 'vendor_company_id');
18
- }
19
- };
20
- module.exports = {
21
- up,
22
- down,
23
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,28 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- await queryInterface.changeColumn('institute_partners', 'institute_id', {
4
- type: Sequelize.UUID,
5
- allowNull: true,
6
- });
7
- await queryInterface.changeColumn('institute_partners', 'vendor_company_id', {
8
- type: Sequelize.STRING,
9
- allowNull: true,
10
- });
11
- };
12
- const down = async (queryInterface, Sequelize) => {
13
- // Note: Reverting this might fail if there are records with null values.
14
- await queryInterface.changeColumn('institute_partners', 'institute_id', {
15
- type: Sequelize.UUID,
16
- allowNull: false,
17
- });
18
- // vendor_company_id was originally nullable in the DB when created,
19
- // but the model required it, so we'll revert to false.
20
- await queryInterface.changeColumn('institute_partners', 'vendor_company_id', {
21
- type: Sequelize.STRING,
22
- allowNull: false,
23
- });
24
- };
25
- module.exports = {
26
- up,
27
- down,
28
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,25 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- await queryInterface.changeColumn('institute_ownership_histories', 'institute_id', {
4
- type: Sequelize.UUID,
5
- allowNull: true,
6
- });
7
- await queryInterface.changeColumn('institute_ownership_histories', 'vendor_company_id', {
8
- type: Sequelize.STRING,
9
- allowNull: true,
10
- });
11
- };
12
- const down = async (queryInterface, Sequelize) => {
13
- await queryInterface.changeColumn('institute_ownership_histories', 'institute_id', {
14
- type: Sequelize.UUID,
15
- allowNull: false,
16
- });
17
- await queryInterface.changeColumn('institute_ownership_histories', 'vendor_company_id', {
18
- type: Sequelize.STRING,
19
- allowNull: false,
20
- });
21
- };
22
- module.exports = {
23
- up,
24
- down,
25
- };
@@ -1,3 +0,0 @@
1
- import { IEmailOptions } from '../index';
2
- export declare const sendEmailDirect: (emailOptions: IEmailOptions) => Promise<void>;
3
- export declare const sendEmail: (emailOptions: IEmailOptions) => Promise<void>;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- // import nodemailer, { Transporter } from 'nodemailer';
3
- // import { IEmailOptions } from '@kipicore/dbcore';
4
- // import { ENV_VARIABLE } from '../configs/env';
5
- // import { emailQueue } from '../queues/emailQueue';
6
- // import { logger } from '../configs/logger';
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.sendEmail = exports.sendEmailDirect = void 0;
9
- // const hasDummyEmail = (to: string | string[]): boolean => {
10
- // if (Array.isArray(to)) {
11
- // return to.some(email => email.toLowerCase().endsWith(ENV_VARIABLE.DUMMY_EMAIL_DOMAIN));
12
- // }
13
- // return to.toLowerCase().endsWith(ENV_VARIABLE.DUMMY_EMAIL_DOMAIN);
14
- // };
15
- // export const sendEmailDirect = async (emailOptions: IEmailOptions): Promise<void> => {
16
- // if (hasDummyEmail(emailOptions.to)) {
17
- // logger.info(`Skipping email for dummy address: ${emailOptions.to}`);
18
- // return;
19
- // }
20
- // // Configure the transporter with type annotations
21
- // const transporter: Transporter = nodemailer.createTransport({
22
- // host: ENV_VARIABLE.SMTP_SERVER, // e.g., 'smtp.gmail.com' for Gmail
23
- // port: ENV_VARIABLE.SMTP_PORT,
24
- // secure: true, // true for 465, false for other ports
25
- // auth: {
26
- // user: ENV_VARIABLE.SMTP_USER, // Your email address
27
- // pass: ENV_VARIABLE.SMTP_PASS, // Your email password
28
- // },
29
- // });
30
- // if (!emailOptions.from) emailOptions.from = ENV_VARIABLE.SMTP_EMAIL;
31
- // try {
32
- // // Send the email
33
- // const info = await transporter.sendMail(emailOptions);
34
- // return info;
35
- // } catch (err) {
36
- // // Handle errors
37
- // console.error('Error sending email:', err);
38
- // throw err;
39
- // }
40
- // };
41
- // export const sendEmail = async (emailOptions: IEmailOptions): Promise<void> => {
42
- // try {
43
- // if (hasDummyEmail(emailOptions.to)) {
44
- // logger.info(`Skipping email for dummy address: ${emailOptions.to}`);
45
- // return;
46
- // }
47
- // await emailQueue.add('send-email', emailOptions);
48
- // logger.info(`Email added to queue for: ${emailOptions.to}`);
49
- // } catch (error) {
50
- // logger.error('Error adding email to queue:', error);
51
- // // Fallback to direct sending if queue fails (optional, but safer)
52
- // await sendEmailDirect(emailOptions);
53
- // }
54
- // };
55
- const client_ses_1 = require("@aws-sdk/client-ses");
56
- const index_1 = require("../index");
57
- const env_1 = require("../configs/env");
58
- const emailQueue_1 = require("../queues/emailQueue");
59
- const logger_1 = require("../configs/logger");
60
- const hasDummyEmail = (to) => {
61
- if (Array.isArray(to)) {
62
- return to.some(email => email.toLowerCase().endsWith(env_1.ENV_VARIABLE.DUMMY_EMAIL_DOMAIN));
63
- }
64
- return to.toLowerCase().endsWith(env_1.ENV_VARIABLE.DUMMY_EMAIL_DOMAIN);
65
- };
66
- const sendEmailDirect = async (emailOptions) => {
67
- if (hasDummyEmail(emailOptions.to)) {
68
- logger_1.logger.info(`Skipping email for dummy address: ${emailOptions.to}`);
69
- return;
70
- }
71
- const ses = await index_1.awsClient.ses();
72
- if (!emailOptions.from) {
73
- emailOptions.from = env_1.ENV_VARIABLE.SMTP_EMAIL;
74
- }
75
- try {
76
- const command = new client_ses_1.SendEmailCommand({
77
- Source: emailOptions.from || 'kipiverseproject@gmail.com',
78
- Destination: {
79
- ToAddresses: Array.isArray(emailOptions.to) ? emailOptions.to : [emailOptions.to],
80
- CcAddresses: (emailOptions.cc || []),
81
- BccAddresses: (emailOptions.bcc || []),
82
- },
83
- Message: {
84
- Subject: {
85
- Data: emailOptions.subject,
86
- },
87
- Body: {
88
- Html: emailOptions.html ? { Data: emailOptions.html } : undefined,
89
- Text: emailOptions.text ? { Data: emailOptions.text } : undefined,
90
- },
91
- },
92
- });
93
- await ses.send(command);
94
- logger_1.logger.info(`Email sent via SES to: ${emailOptions.to}`);
95
- }
96
- catch (err) {
97
- logger_1.logger.error('Error sending email via SES:', err);
98
- throw err;
99
- }
100
- };
101
- exports.sendEmailDirect = sendEmailDirect;
102
- const sendEmail = async (emailOptions) => {
103
- try {
104
- if (hasDummyEmail(emailOptions.to)) {
105
- logger_1.logger.info(`Skipping email for dummy address: ${emailOptions.to}`);
106
- return;
107
- }
108
- await emailQueue_1.emailQueue.add('send-email', emailOptions);
109
- logger_1.logger.info(`Email added to queue for: ${emailOptions.to}`);
110
- }
111
- catch (error) {
112
- logger_1.logger.error('Queue failed, fallback to SES:', error);
113
- // fallback
114
- await (0, exports.sendEmailDirect)(emailOptions);
115
- }
116
- };
117
- exports.sendEmail = sendEmail;
@@ -1,4 +0,0 @@
1
- import { INotificationModelAttributes } from '../index';
2
- export declare const sendPushNotification: (deviceToken: string, notification: INotificationModelAttributes & {
3
- counts?: Record<string, number>;
4
- }) => Promise<void | string>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendPushNotification = void 0;
4
- const app_1 = require("firebase-admin/app");
5
- const messaging_1 = require("firebase-admin/messaging");
6
- const env_1 = require("../configs/env");
7
- // Initialize Firebase if not already initialized
8
- if (!(0, app_1.getApps)().length) {
9
- (0, app_1.initializeApp)({
10
- credential: (0, app_1.cert)({
11
- projectId: env_1.ENV_VARIABLE.FIREBASE_PROJECT_ID,
12
- clientEmail: env_1.ENV_VARIABLE.FIREBASE_CLIENT_EMAIL,
13
- privateKey: env_1.ENV_VARIABLE.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'),
14
- }),
15
- });
16
- }
17
- const sendPushNotification = async (deviceToken, notification) => {
18
- try {
19
- const payload = {
20
- notification: {
21
- title: notification.title,
22
- body: notification.message,
23
- },
24
- token: deviceToken,
25
- };
26
- const response = await (0, messaging_1.getMessaging)().send(payload);
27
- return response;
28
- }
29
- catch (error) {
30
- console.error('Error sending push notification:', error);
31
- return;
32
- }
33
- };
34
- exports.sendPushNotification = sendPushNotification;
@@ -1,5 +0,0 @@
1
- export interface ISMSOptions {
2
- to: string;
3
- message: string;
4
- }
5
- export declare const sendSMSDirect: (smsOptions: ISMSOptions) => Promise<void>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendSMSDirect = void 0;
4
- const client_sns_1 = require("@aws-sdk/client-sns");
5
- const index_1 = require("../index");
6
- const sendSMSDirect = async (smsOptions) => {
7
- try {
8
- const snsClient = await index_1.awsClient.sns();
9
- // const command = new PublishCommand({
10
- // Message: smsOptions.message,
11
- // PhoneNumber: '+918469665568',
12
- // MessageAttributes: {
13
- // 'AWS.SNS.SMS.SenderID': {
14
- // DataType: 'String',
15
- // StringValue: 'KIPI',
16
- // },
17
- // 'AWS.SNS.SMS.SMSType': {
18
- // DataType: 'String',
19
- // StringValue: 'Transactional',
20
- // },
21
- // },
22
- // });
23
- const command = new client_sns_1.PublishCommand({
24
- Message: smsOptions.message,
25
- PhoneNumber: `+91${smsOptions.to}`,
26
- });
27
- await snsClient.send(command);
28
- }
29
- catch (error) {
30
- console.error('SMS sending failed:', error);
31
- // throw error;
32
- }
33
- };
34
- exports.sendSMSDirect = sendSMSDirect;
@@ -1,15 +0,0 @@
1
- import { AI_MODEL_KEYS, AI_MODEL_KEY_TYPES } from "../constants";
2
- export interface IAiModelKeyAttributes {
3
- id: string;
4
- key: AI_MODEL_KEYS;
5
- hasValue: string;
6
- type: AI_MODEL_KEY_TYPES;
7
- description: string;
8
- version: number;
9
- createdBy?: string;
10
- updatedBy?: string;
11
- deletedBy?: string;
12
- createdAt?: Date;
13
- updatedAt?: Date;
14
- deletedAt?: Date;
15
- }