@kipicore/dbcore 1.1.694 → 1.1.695

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 (233) hide show
  1. package/dist/commonValidator/commandValidator.d.ts +27 -0
  2. package/dist/commonValidator/commandValidator.js +225 -0
  3. package/dist/commonValidator/index.d.ts +3 -0
  4. package/dist/commonValidator/index.js +24 -0
  5. package/dist/commonValidator/joiCommonValidator.d.ts +12 -0
  6. package/dist/commonValidator/joiCommonValidator.js +47 -0
  7. package/dist/commonValidator/joiSchemaBuilder.d.ts +6 -0
  8. package/dist/commonValidator/joiSchemaBuilder.js +70 -0
  9. package/dist/configs/env.d.ts +2 -0
  10. package/dist/configs/env.js +4 -0
  11. package/dist/configs/index.d.ts +2 -0
  12. package/dist/configs/index.js +2 -0
  13. package/dist/configs/logger.d.ts +2 -0
  14. package/dist/configs/logger.js +44 -0
  15. package/dist/configs/redisConfig.d.ts +4 -0
  16. package/dist/configs/redisConfig.js +32 -0
  17. package/dist/constants/app.d.ts +30 -58
  18. package/dist/constants/app.js +37 -70
  19. package/dist/constants/defaultModelAttributes.js +2 -1
  20. package/dist/constants/errorMessages.d.ts +20 -1
  21. package/dist/constants/errorMessages.js +22 -1
  22. package/dist/constants/successMessages.d.ts +14 -0
  23. package/dist/constants/successMessages.js +17 -1
  24. package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +46 -0
  25. package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +20 -0
  26. package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +156 -0
  27. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +2 -0
  28. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +19 -0
  29. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +2 -0
  30. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +19 -0
  31. package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +2 -0
  32. package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +19 -0
  33. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.d.ts +2 -0
  34. package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js +12 -0
  35. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +2 -0
  36. package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +42 -0
  37. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.d.ts +2 -0
  38. package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.js +22 -0
  39. package/dist/db/psql/migrations/20260727123149-add_vendorCompanyId_to_institute_ownership_histories.js +23 -0
  40. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.d.ts +2 -0
  41. package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.js +23 -0
  42. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.d.ts +2 -0
  43. package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.js +28 -0
  44. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.d.ts +2 -0
  45. package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.js +25 -0
  46. package/dist/db/psql/migrations/20260729055118-institutePartners.d.ts +2 -0
  47. package/dist/db/psql/migrations/20260729055118-institutePartners.js +28 -0
  48. package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.d.ts +2 -0
  49. package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.js +25 -0
  50. package/dist/helpers/index.d.ts +3 -0
  51. package/dist/helpers/index.js +3 -0
  52. package/dist/helpers/sendEmail.d.ts +3 -0
  53. package/dist/helpers/sendEmail.js +117 -0
  54. package/dist/helpers/sendNotification.d.ts +4 -0
  55. package/dist/helpers/sendNotification.js +34 -0
  56. package/dist/helpers/sendSMS.d.ts +5 -0
  57. package/dist/helpers/sendSMS.js +34 -0
  58. package/dist/helpers/utils.d.ts +5 -3
  59. package/dist/helpers/utils.js +58 -31
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +4 -0
  62. package/dist/interfaces/aiModelKeysInterface.d.ts +15 -0
  63. package/dist/interfaces/categoriesInterface.d.ts +2 -1
  64. package/dist/interfaces/index.d.ts +1 -18
  65. package/dist/interfaces/index.js +1 -19
  66. package/dist/interfaces/instituteInterface.d.ts +1 -0
  67. package/dist/interfaces/instituteOwnershipHistoryInterface.d.ts +2 -1
  68. package/dist/interfaces/institutePartnersInterface.d.ts +2 -1
  69. package/dist/interfaces/photosGalleryInterface.d.ts +1 -3
  70. package/dist/interfaces/sendNotificationInerface.d.ts +0 -2
  71. package/dist/interfaces/subCategoriesInterface.d.ts +2 -1
  72. package/dist/interfaces/subscriptionPlanInterface.d.ts +2 -1
  73. package/dist/interfaces/testimonialInterface.d.ts +0 -1
  74. package/dist/interfaces/userInstituteMetaInterface.d.ts +1 -1
  75. package/dist/interfaces/userInterface.d.ts +3 -1
  76. package/dist/interfaces/vendorCompanyMetaInterface.d.ts +5 -2
  77. package/dist/models/mongodb/index.d.ts +0 -7
  78. package/dist/models/mongodb/index.js +1 -16
  79. package/dist/models/mongodb/photosGalleryModel.js +1 -5
  80. package/dist/models/mongodb/productMetaModel.js +9 -1
  81. package/dist/models/mongodb/subscriptionPlanModel.js +5 -0
  82. package/dist/models/mongodb/userInstituteMetaModel.js +0 -4
  83. package/dist/models/mongodb/vendorCompanyMetaModel.js +15 -1
  84. package/dist/models/psql/SubCategoriesModel.d.ts +2 -1
  85. package/dist/models/psql/SubCategoriesModel.js +5 -0
  86. package/dist/models/psql/aiModelKeysModel.d.ts +20 -0
  87. package/dist/models/psql/aiModelKeysModel.js +70 -0
  88. package/dist/models/psql/categoriesModel.d.ts +2 -1
  89. package/dist/models/psql/categoriesModel.js +5 -0
  90. package/dist/models/psql/fileStorageModel.js +3 -4
  91. package/dist/models/psql/index.d.ts +1 -11
  92. package/dist/models/psql/index.js +4 -25
  93. package/dist/models/psql/instituteModel.d.ts +1 -0
  94. package/dist/models/psql/instituteModel.js +5 -2
  95. package/dist/models/psql/instituteOwnershipHistoryModel.d.ts +2 -1
  96. package/dist/models/psql/instituteOwnershipHistoryModel.js +8 -3
  97. package/dist/models/psql/institutePartnersModel.d.ts +2 -1
  98. package/dist/models/psql/institutePartnersModel.js +8 -3
  99. package/dist/models/psql/sendNotificationModel.d.ts +0 -1
  100. package/dist/models/psql/sendNotificationModel.js +0 -5
  101. package/dist/models/psql/testimonialModel.d.ts +0 -1
  102. package/dist/models/psql/testimonialModel.js +7 -8
  103. package/dist/models/psql/userModel.d.ts +3 -1
  104. package/dist/models/psql/userModel.js +2 -2
  105. package/dist/queues/emailQueue.d.ts +3 -0
  106. package/dist/queues/emailQueue.js +22 -0
  107. package/dist/queues/emailWorker.d.ts +3 -0
  108. package/dist/queues/emailWorker.js +33 -0
  109. package/dist/queues/index.d.ts +2 -0
  110. package/dist/queues/index.js +18 -0
  111. package/dist/types/aiModelKeysType.d.ts +3 -0
  112. package/dist/types/commonType.d.ts +29 -1
  113. package/dist/types/index.d.ts +1 -18
  114. package/dist/types/index.js +1 -19
  115. package/package.json +10 -2
  116. package/dist/db/psql/migrations/20260714095754-create-arena-models.js +0 -642
  117. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +0 -2
  118. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +0 -138
  119. package/dist/db/psql/migrations/20260722143500-create-school_has_sports.js +0 -71
  120. package/dist/db/psql/migrations/20260728170500-add_sports_academy_id_to_testimonials.js +0 -21
  121. package/dist/db/psql/migrations/20260729150700-add_sports_academy_id_to_notifications.js +0 -21
  122. package/dist/interfaces/ageGroupInterface.d.ts +0 -12
  123. package/dist/interfaces/assessmentTestInterface.d.ts +0 -23
  124. package/dist/interfaces/equipmentInterface.d.ts +0 -10
  125. package/dist/interfaces/equipmentInterface.js +0 -2
  126. package/dist/interfaces/facilityMasterInterface.d.ts +0 -9
  127. package/dist/interfaces/facilityMasterInterface.js +0 -2
  128. package/dist/interfaces/schoolHasSportInterface.d.ts +0 -7
  129. package/dist/interfaces/schoolHasSportInterface.js +0 -2
  130. package/dist/interfaces/skillInterface.d.ts +0 -19
  131. package/dist/interfaces/skillInterface.js +0 -2
  132. package/dist/interfaces/sportCategoryInterface.d.ts +0 -9
  133. package/dist/interfaces/sportCategoryInterface.js +0 -2
  134. package/dist/interfaces/sportDataApproveInterface.d.ts +0 -19
  135. package/dist/interfaces/sportDataApproveInterface.js +0 -2
  136. package/dist/interfaces/sportGroupDataInterface.d.ts +0 -7
  137. package/dist/interfaces/sportGroupDataInterface.js +0 -2
  138. package/dist/interfaces/sportInfoInterface.d.ts +0 -24
  139. package/dist/interfaces/sportInfoInterface.js +0 -2
  140. package/dist/interfaces/sportInterface.d.ts +0 -10
  141. package/dist/interfaces/sportInterface.js +0 -2
  142. package/dist/interfaces/sportRoleInterface.d.ts +0 -11
  143. package/dist/interfaces/sportRoleInterface.js +0 -2
  144. package/dist/interfaces/sportSubCategoryInterface.d.ts +0 -10
  145. package/dist/interfaces/sportSubCategoryInterface.js +0 -2
  146. package/dist/interfaces/sportsAcademyInterface.d.ts +0 -39
  147. package/dist/interfaces/sportsAcademyInterface.js +0 -2
  148. package/dist/interfaces/studentSportTestInterface.d.ts +0 -20
  149. package/dist/interfaces/studentSportTestInterface.js +0 -2
  150. package/dist/interfaces/unitInterface.d.ts +0 -10
  151. package/dist/interfaces/unitInterface.js +0 -2
  152. package/dist/interfaces/userAcademyMetaInterface.d.ts +0 -17
  153. package/dist/interfaces/userAcademyMetaInterface.js +0 -2
  154. package/dist/interfaces/userAmenityInterface.d.ts +0 -24
  155. package/dist/interfaces/userAmenityInterface.js +0 -2
  156. package/dist/models/mongodb/assessmentTestModel.d.ts +0 -4
  157. package/dist/models/mongodb/assessmentTestModel.js +0 -72
  158. package/dist/models/mongodb/sportDataApproveModel.d.ts +0 -4
  159. package/dist/models/mongodb/sportDataApproveModel.js +0 -117
  160. package/dist/models/mongodb/sportInfoModel.d.ts +0 -4
  161. package/dist/models/mongodb/sportInfoModel.js +0 -72
  162. package/dist/models/mongodb/sportsAcademyModel.d.ts +0 -4
  163. package/dist/models/mongodb/sportsAcademyModel.js +0 -89
  164. package/dist/models/mongodb/studentSportTestModel.d.ts +0 -4
  165. package/dist/models/mongodb/studentSportTestModel.js +0 -68
  166. package/dist/models/mongodb/userAcademyMetaModel.d.ts +0 -4
  167. package/dist/models/mongodb/userAcademyMetaModel.js +0 -109
  168. package/dist/models/mongodb/userAmenityModel.d.ts +0 -4
  169. package/dist/models/mongodb/userAmenityModel.js +0 -73
  170. package/dist/models/psql/ageGroupModel.d.ts +0 -22
  171. package/dist/models/psql/ageGroupModel.js +0 -76
  172. package/dist/models/psql/equipmentModel.d.ts +0 -20
  173. package/dist/models/psql/equipmentModel.js +0 -57
  174. package/dist/models/psql/facilityMasterModel.d.ts +0 -18
  175. package/dist/models/psql/facilityMasterModel.js +0 -64
  176. package/dist/models/psql/schoolHasSportModel.d.ts +0 -17
  177. package/dist/models/psql/schoolHasSportModel.js +0 -76
  178. package/dist/models/psql/skillModel.d.ts +0 -25
  179. package/dist/models/psql/skillModel.js +0 -99
  180. package/dist/models/psql/sportCategoryModel.d.ts +0 -19
  181. package/dist/models/psql/sportCategoryModel.js +0 -53
  182. package/dist/models/psql/sportGroupDataModel.d.ts +0 -13
  183. package/dist/models/psql/sportGroupDataModel.js +0 -64
  184. package/dist/models/psql/sportModel.d.ts +0 -20
  185. package/dist/models/psql/sportModel.js +0 -58
  186. package/dist/models/psql/sportRoleModel.d.ts +0 -21
  187. package/dist/models/psql/sportRoleModel.js +0 -71
  188. package/dist/models/psql/sportSubCategoryModel.d.ts +0 -20
  189. package/dist/models/psql/sportSubCategoryModel.js +0 -75
  190. package/dist/models/psql/unitModel.d.ts +0 -20
  191. package/dist/models/psql/unitModel.js +0 -57
  192. package/dist/types/ageGroupType.d.ts +0 -2
  193. package/dist/types/ageGroupType.js +0 -2
  194. package/dist/types/assessmentTestType.d.ts +0 -2
  195. package/dist/types/assessmentTestType.js +0 -2
  196. package/dist/types/equipmentType.d.ts +0 -2
  197. package/dist/types/equipmentType.js +0 -2
  198. package/dist/types/facilityMasterType.d.ts +0 -3
  199. package/dist/types/facilityMasterType.js +0 -2
  200. package/dist/types/schoolHasSportType.d.ts +0 -2
  201. package/dist/types/schoolHasSportType.js +0 -2
  202. package/dist/types/skillType.d.ts +0 -2
  203. package/dist/types/skillType.js +0 -2
  204. package/dist/types/sportCategoryType.d.ts +0 -2
  205. package/dist/types/sportCategoryType.js +0 -2
  206. package/dist/types/sportDataApproveType.d.ts +0 -2
  207. package/dist/types/sportDataApproveType.js +0 -2
  208. package/dist/types/sportGroupDataType.d.ts +0 -3
  209. package/dist/types/sportGroupDataType.js +0 -2
  210. package/dist/types/sportInfoType.d.ts +0 -2
  211. package/dist/types/sportInfoType.js +0 -2
  212. package/dist/types/sportRoleType.d.ts +0 -2
  213. package/dist/types/sportRoleType.js +0 -2
  214. package/dist/types/sportSubCategoryType.d.ts +0 -2
  215. package/dist/types/sportSubCategoryType.js +0 -2
  216. package/dist/types/sportType.d.ts +0 -2
  217. package/dist/types/sportType.js +0 -2
  218. package/dist/types/sportsAcademyType.d.ts +0 -2
  219. package/dist/types/sportsAcademyType.js +0 -2
  220. package/dist/types/studentSportTestType.d.ts +0 -2
  221. package/dist/types/studentSportTestType.js +0 -2
  222. package/dist/types/unitType.d.ts +0 -2
  223. package/dist/types/unitType.js +0 -2
  224. package/dist/types/userAcademyMetaType.d.ts +0 -2
  225. package/dist/types/userAcademyMetaType.js +0 -2
  226. package/dist/types/userAmenityType.d.ts +0 -2
  227. package/dist/types/userAmenityType.js +0 -2
  228. /package/dist/db/psql/migrations/{20260714095754-create-arena-models.d.ts → 20260714111425-change_status_enum_to_string_in_institutes.d.ts} +0 -0
  229. /package/dist/db/psql/migrations/{20260722143500-create-school_has_sports.d.ts → 20260714131500-add_note_to_institutes.d.ts} +0 -0
  230. /package/dist/db/psql/migrations/{20260728170500-add_sports_academy_id_to_testimonials.d.ts → 20260715150000-create-ai-model-keys.d.ts} +0 -0
  231. /package/dist/db/psql/migrations/{20260729150700-add_sports_academy_id_to_notifications.d.ts → 20260727123149-add_vendorCompanyId_to_institute_ownership_histories.d.ts} +0 -0
  232. /package/dist/interfaces/{ageGroupInterface.js → aiModelKeysInterface.js} +0 -0
  233. /package/dist/{interfaces/assessmentTestInterface.js → types/aiModelKeysType.js} +0 -0
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ up: async (queryInterface, Sequelize) => {
4
+ const table = await queryInterface.describeTable('institutes');
5
+ if (table.status) {
6
+ // In PostgreSQL, changing from ENUM to VARCHAR often requires a USING clause
7
+ try {
8
+ await queryInterface.sequelize.query('ALTER TABLE institutes ALTER COLUMN status TYPE VARCHAR(255) USING status::varchar;');
9
+ await queryInterface.changeColumn('institutes', 'status', {
10
+ type: Sequelize.STRING,
11
+ allowNull: false,
12
+ defaultValue: 'ACTIVE',
13
+ });
14
+ }
15
+ catch (error) {
16
+ // Fallback if the raw query fails
17
+ await queryInterface.changeColumn('institutes', 'status', {
18
+ type: Sequelize.STRING,
19
+ allowNull: false,
20
+ defaultValue: 'ACTIVE',
21
+ });
22
+ }
23
+ }
24
+ },
25
+ down: async (queryInterface, Sequelize) => {
26
+ const table = await queryInterface.describeTable('institutes');
27
+ if (table.status) {
28
+ try {
29
+ await queryInterface.sequelize.query('ALTER TABLE institutes ALTER COLUMN status TYPE "enum_institutes_status" USING status::text::"enum_institutes_status";');
30
+ await queryInterface.changeColumn('institutes', 'status', {
31
+ type: Sequelize.ENUM('ACTIVE', 'INACTIVE', 'PENDING', 'BLOCKED'), // Typical statuses, can adapt if needed
32
+ allowNull: false,
33
+ defaultValue: 'ACTIVE',
34
+ });
35
+ }
36
+ catch (error) {
37
+ // Fallback
38
+ await queryInterface.changeColumn('institutes', 'status', {
39
+ type: Sequelize.ENUM('ACTIVE', 'INACTIVE', 'PENDING', 'BLOCKED'),
40
+ allowNull: false,
41
+ defaultValue: 'ACTIVE',
42
+ });
43
+ }
44
+ }
45
+ }
46
+ };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('institutes');
4
+ if (!table.note) {
5
+ await queryInterface.addColumn('institutes', 'note', {
6
+ type: Sequelize.STRING,
7
+ allowNull: true,
8
+ });
9
+ }
10
+ };
11
+ const down = async (queryInterface) => {
12
+ const table = await queryInterface.describeTable('institutes');
13
+ if (table.note) {
14
+ await queryInterface.removeColumn('institutes', 'note');
15
+ }
16
+ };
17
+ module.exports = {
18
+ up,
19
+ down,
20
+ };
@@ -0,0 +1,156 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,19 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,19 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,19 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,12 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,42 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,22 @@
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
+ };
@@ -0,0 +1,23 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -0,0 +1,23 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,28 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,25 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,28 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,25 @@
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,2 +1,5 @@
1
1
  export * from './s3Uploader';
2
2
  export * from './utils';
3
+ export * from './sendEmail';
4
+ export * from './sendNotification';
5
+ export * from './sendSMS';
@@ -16,3 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./s3Uploader"), exports);
18
18
  __exportStar(require("./utils"), exports);
19
+ __exportStar(require("./sendEmail"), exports);
20
+ __exportStar(require("./sendNotification"), exports);
21
+ __exportStar(require("./sendSMS"), exports);
@@ -0,0 +1,3 @@
1
+ import { IEmailOptions } from '../index';
2
+ export declare const sendEmailDirect: (emailOptions: IEmailOptions) => Promise<void>;
3
+ export declare const sendEmail: (emailOptions: IEmailOptions) => Promise<void>;