@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.
- package/dist/commonValidator/commandValidator.d.ts +27 -0
- package/dist/commonValidator/commandValidator.js +225 -0
- package/dist/commonValidator/index.d.ts +3 -0
- package/dist/commonValidator/index.js +24 -0
- package/dist/commonValidator/joiCommonValidator.d.ts +12 -0
- package/dist/commonValidator/joiCommonValidator.js +47 -0
- package/dist/commonValidator/joiSchemaBuilder.d.ts +6 -0
- package/dist/commonValidator/joiSchemaBuilder.js +70 -0
- package/dist/configs/env.d.ts +2 -0
- package/dist/configs/env.js +4 -0
- package/dist/configs/index.d.ts +2 -0
- package/dist/configs/index.js +2 -0
- package/dist/configs/logger.d.ts +2 -0
- package/dist/configs/logger.js +44 -0
- package/dist/configs/redisConfig.d.ts +4 -0
- package/dist/configs/redisConfig.js +32 -0
- package/dist/constants/app.d.ts +30 -58
- package/dist/constants/app.js +37 -70
- package/dist/constants/defaultModelAttributes.js +2 -1
- package/dist/constants/errorMessages.d.ts +20 -1
- package/dist/constants/errorMessages.js +22 -1
- package/dist/constants/successMessages.d.ts +14 -0
- package/dist/constants/successMessages.js +17 -1
- package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +46 -0
- package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +20 -0
- package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +156 -0
- package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +2 -0
- package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +19 -0
- package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +2 -0
- package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +19 -0
- package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +2 -0
- package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +19 -0
- package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.d.ts +2 -0
- package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js +12 -0
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +2 -0
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +42 -0
- package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.d.ts +2 -0
- package/dist/db/psql/migrations/20260722130134-add_portfolio_theme_to_users.js +22 -0
- package/dist/db/psql/migrations/20260727123149-add_vendorCompanyId_to_institute_ownership_histories.js +23 -0
- package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.d.ts +2 -0
- package/dist/db/psql/migrations/20260727130802-add_vendorCompanyId_to_institute_partners.js +23 -0
- package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.d.ts +2 -0
- package/dist/db/psql/migrations/20260727132312-make_instituteId_and_vendorCompanyId_optional_in_institute_partners.js +28 -0
- package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.d.ts +2 -0
- package/dist/db/psql/migrations/20260727132747-make_instituteId_and_vendorCompanyId_optional_in_institute_ownership_histories.js +25 -0
- package/dist/db/psql/migrations/20260729055118-institutePartners.d.ts +2 -0
- package/dist/db/psql/migrations/20260729055118-institutePartners.js +28 -0
- package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.d.ts +2 -0
- package/dist/db/psql/migrations/20260729055121-instituteOwnershipHistory.js +25 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +3 -0
- package/dist/helpers/sendEmail.d.ts +3 -0
- package/dist/helpers/sendEmail.js +117 -0
- package/dist/helpers/sendNotification.d.ts +4 -0
- package/dist/helpers/sendNotification.js +34 -0
- package/dist/helpers/sendSMS.d.ts +5 -0
- package/dist/helpers/sendSMS.js +34 -0
- package/dist/helpers/utils.d.ts +5 -3
- package/dist/helpers/utils.js +58 -31
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/aiModelKeysInterface.d.ts +15 -0
- package/dist/interfaces/categoriesInterface.d.ts +2 -1
- package/dist/interfaces/index.d.ts +1 -18
- package/dist/interfaces/index.js +1 -19
- package/dist/interfaces/instituteInterface.d.ts +1 -0
- package/dist/interfaces/instituteOwnershipHistoryInterface.d.ts +2 -1
- package/dist/interfaces/institutePartnersInterface.d.ts +2 -1
- package/dist/interfaces/photosGalleryInterface.d.ts +1 -3
- package/dist/interfaces/sendNotificationInerface.d.ts +0 -2
- package/dist/interfaces/subCategoriesInterface.d.ts +2 -1
- package/dist/interfaces/subscriptionPlanInterface.d.ts +2 -1
- package/dist/interfaces/testimonialInterface.d.ts +0 -1
- package/dist/interfaces/userInstituteMetaInterface.d.ts +1 -1
- package/dist/interfaces/userInterface.d.ts +3 -1
- package/dist/interfaces/vendorCompanyMetaInterface.d.ts +5 -2
- package/dist/models/mongodb/index.d.ts +0 -7
- package/dist/models/mongodb/index.js +1 -16
- package/dist/models/mongodb/photosGalleryModel.js +1 -5
- package/dist/models/mongodb/productMetaModel.js +9 -1
- package/dist/models/mongodb/subscriptionPlanModel.js +5 -0
- package/dist/models/mongodb/userInstituteMetaModel.js +0 -4
- package/dist/models/mongodb/vendorCompanyMetaModel.js +15 -1
- package/dist/models/psql/SubCategoriesModel.d.ts +2 -1
- package/dist/models/psql/SubCategoriesModel.js +5 -0
- package/dist/models/psql/aiModelKeysModel.d.ts +20 -0
- package/dist/models/psql/aiModelKeysModel.js +70 -0
- package/dist/models/psql/categoriesModel.d.ts +2 -1
- package/dist/models/psql/categoriesModel.js +5 -0
- package/dist/models/psql/fileStorageModel.js +3 -4
- package/dist/models/psql/index.d.ts +1 -11
- package/dist/models/psql/index.js +4 -25
- package/dist/models/psql/instituteModel.d.ts +1 -0
- package/dist/models/psql/instituteModel.js +5 -2
- package/dist/models/psql/instituteOwnershipHistoryModel.d.ts +2 -1
- package/dist/models/psql/instituteOwnershipHistoryModel.js +8 -3
- package/dist/models/psql/institutePartnersModel.d.ts +2 -1
- package/dist/models/psql/institutePartnersModel.js +8 -3
- package/dist/models/psql/sendNotificationModel.d.ts +0 -1
- package/dist/models/psql/sendNotificationModel.js +0 -5
- package/dist/models/psql/testimonialModel.d.ts +0 -1
- package/dist/models/psql/testimonialModel.js +7 -8
- package/dist/models/psql/userModel.d.ts +3 -1
- package/dist/models/psql/userModel.js +2 -2
- package/dist/queues/emailQueue.d.ts +3 -0
- package/dist/queues/emailQueue.js +22 -0
- package/dist/queues/emailWorker.d.ts +3 -0
- package/dist/queues/emailWorker.js +33 -0
- package/dist/queues/index.d.ts +2 -0
- package/dist/queues/index.js +18 -0
- package/dist/types/aiModelKeysType.d.ts +3 -0
- package/dist/types/commonType.d.ts +29 -1
- package/dist/types/index.d.ts +1 -18
- package/dist/types/index.js +1 -19
- package/package.json +10 -2
- package/dist/db/psql/migrations/20260714095754-create-arena-models.js +0 -642
- package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +0 -2
- package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +0 -138
- package/dist/db/psql/migrations/20260722143500-create-school_has_sports.js +0 -71
- package/dist/db/psql/migrations/20260728170500-add_sports_academy_id_to_testimonials.js +0 -21
- package/dist/db/psql/migrations/20260729150700-add_sports_academy_id_to_notifications.js +0 -21
- package/dist/interfaces/ageGroupInterface.d.ts +0 -12
- package/dist/interfaces/assessmentTestInterface.d.ts +0 -23
- package/dist/interfaces/equipmentInterface.d.ts +0 -10
- package/dist/interfaces/equipmentInterface.js +0 -2
- package/dist/interfaces/facilityMasterInterface.d.ts +0 -9
- package/dist/interfaces/facilityMasterInterface.js +0 -2
- package/dist/interfaces/schoolHasSportInterface.d.ts +0 -7
- package/dist/interfaces/schoolHasSportInterface.js +0 -2
- package/dist/interfaces/skillInterface.d.ts +0 -19
- package/dist/interfaces/skillInterface.js +0 -2
- package/dist/interfaces/sportCategoryInterface.d.ts +0 -9
- package/dist/interfaces/sportCategoryInterface.js +0 -2
- package/dist/interfaces/sportDataApproveInterface.d.ts +0 -19
- package/dist/interfaces/sportDataApproveInterface.js +0 -2
- package/dist/interfaces/sportGroupDataInterface.d.ts +0 -7
- package/dist/interfaces/sportGroupDataInterface.js +0 -2
- package/dist/interfaces/sportInfoInterface.d.ts +0 -24
- package/dist/interfaces/sportInfoInterface.js +0 -2
- package/dist/interfaces/sportInterface.d.ts +0 -10
- package/dist/interfaces/sportInterface.js +0 -2
- package/dist/interfaces/sportRoleInterface.d.ts +0 -11
- package/dist/interfaces/sportRoleInterface.js +0 -2
- package/dist/interfaces/sportSubCategoryInterface.d.ts +0 -10
- package/dist/interfaces/sportSubCategoryInterface.js +0 -2
- package/dist/interfaces/sportsAcademyInterface.d.ts +0 -39
- package/dist/interfaces/sportsAcademyInterface.js +0 -2
- package/dist/interfaces/studentSportTestInterface.d.ts +0 -20
- package/dist/interfaces/studentSportTestInterface.js +0 -2
- package/dist/interfaces/unitInterface.d.ts +0 -10
- package/dist/interfaces/unitInterface.js +0 -2
- package/dist/interfaces/userAcademyMetaInterface.d.ts +0 -17
- package/dist/interfaces/userAcademyMetaInterface.js +0 -2
- package/dist/interfaces/userAmenityInterface.d.ts +0 -24
- package/dist/interfaces/userAmenityInterface.js +0 -2
- package/dist/models/mongodb/assessmentTestModel.d.ts +0 -4
- package/dist/models/mongodb/assessmentTestModel.js +0 -72
- package/dist/models/mongodb/sportDataApproveModel.d.ts +0 -4
- package/dist/models/mongodb/sportDataApproveModel.js +0 -117
- package/dist/models/mongodb/sportInfoModel.d.ts +0 -4
- package/dist/models/mongodb/sportInfoModel.js +0 -72
- package/dist/models/mongodb/sportsAcademyModel.d.ts +0 -4
- package/dist/models/mongodb/sportsAcademyModel.js +0 -89
- package/dist/models/mongodb/studentSportTestModel.d.ts +0 -4
- package/dist/models/mongodb/studentSportTestModel.js +0 -68
- package/dist/models/mongodb/userAcademyMetaModel.d.ts +0 -4
- package/dist/models/mongodb/userAcademyMetaModel.js +0 -109
- package/dist/models/mongodb/userAmenityModel.d.ts +0 -4
- package/dist/models/mongodb/userAmenityModel.js +0 -73
- package/dist/models/psql/ageGroupModel.d.ts +0 -22
- package/dist/models/psql/ageGroupModel.js +0 -76
- package/dist/models/psql/equipmentModel.d.ts +0 -20
- package/dist/models/psql/equipmentModel.js +0 -57
- package/dist/models/psql/facilityMasterModel.d.ts +0 -18
- package/dist/models/psql/facilityMasterModel.js +0 -64
- package/dist/models/psql/schoolHasSportModel.d.ts +0 -17
- package/dist/models/psql/schoolHasSportModel.js +0 -76
- package/dist/models/psql/skillModel.d.ts +0 -25
- package/dist/models/psql/skillModel.js +0 -99
- package/dist/models/psql/sportCategoryModel.d.ts +0 -19
- package/dist/models/psql/sportCategoryModel.js +0 -53
- package/dist/models/psql/sportGroupDataModel.d.ts +0 -13
- package/dist/models/psql/sportGroupDataModel.js +0 -64
- package/dist/models/psql/sportModel.d.ts +0 -20
- package/dist/models/psql/sportModel.js +0 -58
- package/dist/models/psql/sportRoleModel.d.ts +0 -21
- package/dist/models/psql/sportRoleModel.js +0 -71
- package/dist/models/psql/sportSubCategoryModel.d.ts +0 -20
- package/dist/models/psql/sportSubCategoryModel.js +0 -75
- package/dist/models/psql/unitModel.d.ts +0 -20
- package/dist/models/psql/unitModel.js +0 -57
- package/dist/types/ageGroupType.d.ts +0 -2
- package/dist/types/ageGroupType.js +0 -2
- package/dist/types/assessmentTestType.d.ts +0 -2
- package/dist/types/assessmentTestType.js +0 -2
- package/dist/types/equipmentType.d.ts +0 -2
- package/dist/types/equipmentType.js +0 -2
- package/dist/types/facilityMasterType.d.ts +0 -3
- package/dist/types/facilityMasterType.js +0 -2
- package/dist/types/schoolHasSportType.d.ts +0 -2
- package/dist/types/schoolHasSportType.js +0 -2
- package/dist/types/skillType.d.ts +0 -2
- package/dist/types/skillType.js +0 -2
- package/dist/types/sportCategoryType.d.ts +0 -2
- package/dist/types/sportCategoryType.js +0 -2
- package/dist/types/sportDataApproveType.d.ts +0 -2
- package/dist/types/sportDataApproveType.js +0 -2
- package/dist/types/sportGroupDataType.d.ts +0 -3
- package/dist/types/sportGroupDataType.js +0 -2
- package/dist/types/sportInfoType.d.ts +0 -2
- package/dist/types/sportInfoType.js +0 -2
- package/dist/types/sportRoleType.d.ts +0 -2
- package/dist/types/sportRoleType.js +0 -2
- package/dist/types/sportSubCategoryType.d.ts +0 -2
- package/dist/types/sportSubCategoryType.js +0 -2
- package/dist/types/sportType.d.ts +0 -2
- package/dist/types/sportType.js +0 -2
- package/dist/types/sportsAcademyType.d.ts +0 -2
- package/dist/types/sportsAcademyType.js +0 -2
- package/dist/types/studentSportTestType.d.ts +0 -2
- package/dist/types/studentSportTestType.js +0 -2
- package/dist/types/unitType.d.ts +0 -2
- package/dist/types/unitType.js +0 -2
- package/dist/types/userAcademyMetaType.d.ts +0 -2
- package/dist/types/userAcademyMetaType.js +0 -2
- package/dist/types/userAmenityType.d.ts +0 -2
- package/dist/types/userAmenityType.js +0 -2
- /package/dist/db/psql/migrations/{20260714095754-create-arena-models.d.ts → 20260714111425-change_status_enum_to_string_in_institutes.d.ts} +0 -0
- /package/dist/db/psql/migrations/{20260722143500-create-school_has_sports.d.ts → 20260714131500-add_note_to_institutes.d.ts} +0 -0
- /package/dist/db/psql/migrations/{20260728170500-add_sports_academy_id_to_testimonials.d.ts → 20260715150000-create-ai-model-keys.d.ts} +0 -0
- /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
- /package/dist/interfaces/{ageGroupInterface.js → aiModelKeysInterface.js} +0 -0
- /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,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,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,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
|
+
};
|
package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js
ADDED
|
@@ -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,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,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,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,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,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,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,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
|
+
};
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -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);
|