@kipicore/dbcore 1.1.686 → 1.1.687
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 +27 -29
- package/dist/constants/app.js +37 -39
- 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.d.ts +2 -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/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 -16
- package/dist/interfaces/index.js +1 -17
- 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/subCategoriesInterface.d.ts +2 -1
- package/dist/interfaces/subscriptionPlanInterface.d.ts +2 -1
- package/dist/interfaces/testimonialInterface.d.ts +0 -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 -5
- package/dist/models/mongodb/index.js +1 -12
- 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/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/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 -16
- package/dist/types/index.js +1 -17
- 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/interfaces/ageGroupInterface.d.ts +0 -12
- package/dist/interfaces/amenityInterface.d.ts +0 -23
- package/dist/interfaces/assessmentTestInterface.d.ts +0 -23
- package/dist/interfaces/assessmentTestInterface.js +0 -2
- 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/sportGroupDataInterface.d.ts +0 -7
- package/dist/interfaces/sportGroupDataInterface.js +0 -2
- package/dist/interfaces/sportInfoInterface.d.ts +0 -23
- 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/userAmenityInterface.d.ts +0 -23
- package/dist/interfaces/userAmenityInterface.js +0 -2
- package/dist/models/mongodb/amenityModel.d.ts +0 -4
- package/dist/models/mongodb/amenityModel.js +0 -72
- package/dist/models/mongodb/assessmentTestModel.d.ts +0 -4
- package/dist/models/mongodb/assessmentTestModel.js +0 -72
- package/dist/models/mongodb/sportInfoModel.d.ts +0 -4
- package/dist/models/mongodb/sportInfoModel.js +0 -71
- 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/userAmenityModel.d.ts +0 -4
- package/dist/models/mongodb/userAmenityModel.js +0 -72
- 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/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/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/interfaces/{ageGroupInterface.js → aiModelKeysInterface.js} +0 -0
- /package/dist/{interfaces/amenityInterface.js → types/aiModelKeysType.js} +0 -0
|
@@ -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
|
+
};
|
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);
|
|
@@ -0,0 +1,117 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
package/dist/helpers/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import { TCustomHeaders } from '../types/commonType';
|
|
1
3
|
import { GRADE } from '../constants/app';
|
|
2
4
|
import Joi from 'joi';
|
|
3
5
|
import { OrderItem } from 'sequelize';
|
|
@@ -156,9 +158,6 @@ export declare function extractFromObject(data: any[], config: {
|
|
|
156
158
|
userdata: any[];
|
|
157
159
|
columns: string[];
|
|
158
160
|
};
|
|
159
|
-
export declare const enumAlternatives: (enumObj: Record<string, string>, isRequired?: boolean, allowArray?: boolean) => Joi.StringSchema<string> | Joi.AlternativesSchema<any>;
|
|
160
|
-
export declare const objectIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
|
|
161
|
-
export declare const uuidIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
|
|
162
161
|
export declare const customPagination: <T>(data: T[], page: number, limit: number, totalRecords: number) => Promise<{
|
|
163
162
|
limit: number;
|
|
164
163
|
totalRecords: number;
|
|
@@ -179,4 +178,7 @@ export declare const calculateGrade: (subject: {
|
|
|
179
178
|
obtained: number;
|
|
180
179
|
}) => GRADE;
|
|
181
180
|
export declare const getOverallGrade: (subjects: Subject[]) => GRADE;
|
|
181
|
+
export declare const readEmailTemplate: (templateName: string) => Promise<string>;
|
|
182
|
+
export declare const readEmailTemplateWithOutGlobal: (data: any, templateName?: string) => Promise<string>;
|
|
183
|
+
export declare const assignHeaderValues: <T extends Record<string, any>>(bodyData: T, req: Request, fields: Array<keyof TCustomHeaders>) => T;
|
|
182
184
|
export {};
|
package/dist/helpers/utils.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.assignHeaderValues = exports.readEmailTemplateWithOutGlobal = exports.readEmailTemplate = exports.getOverallGrade = exports.calculateGrade = exports.getNextLetter = exports.getCityAreas = exports.generateVoucherCode = exports.verifyHmacSHA256 = exports.generateHmacSHA256 = exports.customPagination = exports.fromSnakeCaseToNormalText = exports.normalizeToArray = exports.capitalizeFirst = exports.parseOrderOptions = exports.isValidUUID = exports.removeFalsyValues = exports.flattenNestedStructure = exports.buildNestedStructure = exports.getParentsByChildrenId = exports.getChildrenByParentId = exports.sortArray = exports.groupByFields = exports.endOfDay = exports.generateUuidToNumber = exports.startOfDay = exports.isDateWithinRange = exports.isTimeWithinRange = exports.keyByFieldOrFields = exports.getUniqueArrayByFields = exports.generateTempPassword = exports.generateAlphaNumericCode = exports.generateOtp = exports.ensureDirectoryExists = exports.omit = exports.isValidMongoDbId = exports.pick = void 0;
|
|
40
40
|
exports.groupByFieldOrFields = groupByFieldOrFields;
|
|
41
41
|
exports.slugify = slugify;
|
|
42
42
|
exports.assignNonNull = assignNonNull;
|
|
@@ -51,6 +51,8 @@ const uuid = require('uuid');
|
|
|
51
51
|
const crypto_1 = __importDefault(require("crypto"));
|
|
52
52
|
const sequelize_1 = require("sequelize");
|
|
53
53
|
const axios_1 = __importDefault(require("axios"));
|
|
54
|
+
const ejs_1 = __importDefault(require("ejs"));
|
|
55
|
+
const path_1 = __importDefault(require("path"));
|
|
54
56
|
const PASSWORD_REGEX = new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!.@#$%^&*])(?=.{8,})');
|
|
55
57
|
const pick = (objOrArray, keys) => {
|
|
56
58
|
const pickObject = (obj) => keys.reduce((acc, key) => {
|
|
@@ -506,9 +508,10 @@ const parseOrderOptions = (inputOrder, defaultOrder = [['createdAt', 'DESC']]) =
|
|
|
506
508
|
return order;
|
|
507
509
|
};
|
|
508
510
|
exports.parseOrderOptions = parseOrderOptions;
|
|
511
|
+
const configs_1 = require("../configs");
|
|
509
512
|
const capitalizeFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
510
513
|
exports.capitalizeFirst = capitalizeFirst;
|
|
511
|
-
const normalizeToArray = (value) => value ? (Array.isArray(value) ? value : [value]) : undefined;
|
|
514
|
+
const normalizeToArray = (value) => (value ? (Array.isArray(value) ? value : [value]) : undefined);
|
|
512
515
|
exports.normalizeToArray = normalizeToArray;
|
|
513
516
|
/**
|
|
514
517
|
* Converts a snake_case string to Normal Text
|
|
@@ -541,8 +544,7 @@ function assignNonNull(target, source) {
|
|
|
541
544
|
});
|
|
542
545
|
}
|
|
543
546
|
function isUserSchoolInfoUpdate(institute, reqUser) {
|
|
544
|
-
return
|
|
545
|
-
(reqUser.isAddDetails || reqUser.type === app_1.USER_TYPES.INSTITUTE_MASTER_ADMIN || reqUser.type === app_1.USER_TYPES.INSTITUTE_ADMIN));
|
|
547
|
+
return !!(institute.type || institute.subType) && (reqUser.isAddDetails || reqUser.type === app_1.USER_TYPES.INSTITUTE_MASTER_ADMIN || reqUser.type === app_1.USER_TYPES.INSTITUTE_ADMIN);
|
|
546
548
|
}
|
|
547
549
|
function chunkArray(array, size) {
|
|
548
550
|
const chunks = [];
|
|
@@ -614,33 +616,6 @@ function extractFromObject(data, config) {
|
|
|
614
616
|
});
|
|
615
617
|
return { tableTitle: config.tableTitle, userdata, columns };
|
|
616
618
|
}
|
|
617
|
-
const enumAlternatives = (enumObj, isRequired = false, allowArray = true) => {
|
|
618
|
-
const base = joi_1.default.string().valid(...Object.values(enumObj));
|
|
619
|
-
if (allowArray) {
|
|
620
|
-
const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
|
|
621
|
-
return isRequired ? alt.required() : alt.optional();
|
|
622
|
-
}
|
|
623
|
-
return isRequired ? base.required() : base.optional();
|
|
624
|
-
};
|
|
625
|
-
exports.enumAlternatives = enumAlternatives;
|
|
626
|
-
const objectIdAlternatives = (isRequired = false, allowArray = true) => {
|
|
627
|
-
const base = joi_1.default.string()
|
|
628
|
-
.pattern(/^[0-9a-fA-F]{24}$/)
|
|
629
|
-
.message('Invalid ObjectId format');
|
|
630
|
-
if (allowArray) {
|
|
631
|
-
const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
|
|
632
|
-
return isRequired ? alt.required() : alt.optional();
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
exports.objectIdAlternatives = objectIdAlternatives;
|
|
636
|
-
const uuidIdAlternatives = (isRequired = false, allowArray = true) => {
|
|
637
|
-
const base = joi_1.default.string().uuid().message('Invalid Uuid format');
|
|
638
|
-
if (allowArray) {
|
|
639
|
-
const alt = joi_1.default.alternatives().try(base, joi_1.default.array().items(base));
|
|
640
|
-
return isRequired ? alt.required() : alt.optional();
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
exports.uuidIdAlternatives = uuidIdAlternatives;
|
|
644
619
|
const customPagination = async (data, page, limit, totalRecords) => {
|
|
645
620
|
page = Math.max(1, page || app_1.PAGINATION.PAGE);
|
|
646
621
|
limit = Math.max(1, limit || app_1.PAGINATION.LIMIT);
|
|
@@ -761,3 +736,55 @@ const getOverallGrade = (subjects) => {
|
|
|
761
736
|
return worstGrade;
|
|
762
737
|
};
|
|
763
738
|
exports.getOverallGrade = getOverallGrade;
|
|
739
|
+
const readEmailTemplate = async (templateName) => {
|
|
740
|
+
const globalFilePath = path_1.default.join(process.cwd(), 'emailTemplates', `globalEmailTemplate.ejs`);
|
|
741
|
+
const filePath = path_1.default.join(process.cwd(), 'emailTemplates', `${templateName}.ejs`);
|
|
742
|
+
let globalEmailTemplate = await fs_1.default.readFileSync(globalFilePath, 'utf-8');
|
|
743
|
+
const html = ejs_1.default.render(globalEmailTemplate, {
|
|
744
|
+
data: {
|
|
745
|
+
kipiLogo: `${configs_1.ENV_VARIABLE.SERVER_URL}/public/kipilogo.png`,
|
|
746
|
+
googlePlayLogo: `${configs_1.ENV_VARIABLE.SERVER_URL}/public/googleplaylogo.png`,
|
|
747
|
+
applePlayLogo: `${configs_1.ENV_VARIABLE.SERVER_URL}/public/appleplaylogo.png`,
|
|
748
|
+
},
|
|
749
|
+
});
|
|
750
|
+
globalEmailTemplate = html.replace(/\r\n/g, '');
|
|
751
|
+
return new Promise((resolve, reject) => {
|
|
752
|
+
fs_1.default.readFile(filePath, 'utf-8', (err, content) => {
|
|
753
|
+
if (err) {
|
|
754
|
+
return reject(err);
|
|
755
|
+
}
|
|
756
|
+
resolve(globalEmailTemplate.replace(/{{content}}/g, content));
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
exports.readEmailTemplate = readEmailTemplate;
|
|
761
|
+
const readEmailTemplateWithOutGlobal = async (data, templateName) => {
|
|
762
|
+
return new Promise((resolve, reject) => {
|
|
763
|
+
const templatePath = path_1.default.join(process.cwd(), 'emailTemplates', `${templateName || app_1.EMAIL_TEMPLATES.COMMON_TEMPLATE}.ejs`);
|
|
764
|
+
fs_1.default.readFile(templatePath, 'utf-8', (err, templateContent) => {
|
|
765
|
+
if (err) {
|
|
766
|
+
return reject(err);
|
|
767
|
+
}
|
|
768
|
+
const html = ejs_1.default.render(templateContent, {
|
|
769
|
+
logoUrl: data.instituteLogo,
|
|
770
|
+
content: data.content,
|
|
771
|
+
googlePlayLogo: `${process.env.SERVER_URL}/public/googleplaylogo.png`,
|
|
772
|
+
appStoreLogo: `${process.env.SERVER_URL}/public/appleplaylogo.png`,
|
|
773
|
+
});
|
|
774
|
+
resolve(html);
|
|
775
|
+
});
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
exports.readEmailTemplateWithOutGlobal = readEmailTemplateWithOutGlobal;
|
|
779
|
+
const assignHeaderValues = (bodyData, req, fields) => {
|
|
780
|
+
fields.forEach(field => {
|
|
781
|
+
const key = field;
|
|
782
|
+
if (bodyData[key] !== undefined && bodyData[key] !== null)
|
|
783
|
+
return;
|
|
784
|
+
if (req.customHeaders?.[field] !== undefined && req.customHeaders?.[field] !== null) {
|
|
785
|
+
bodyData[key] = req.customHeaders[field];
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
return bodyData;
|
|
789
|
+
};
|
|
790
|
+
exports.assignHeaderValues = assignHeaderValues;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,3 +15,7 @@ export * from './models/mongodb/index';
|
|
|
15
15
|
export * from './models/psql/index';
|
|
16
16
|
/************ types *************/
|
|
17
17
|
export * from './types/index';
|
|
18
|
+
/************ validator ********** */
|
|
19
|
+
export * from './commonValidator';
|
|
20
|
+
/************ queues *************/
|
|
21
|
+
export * from './queues/index';
|
package/dist/index.js
CHANGED
|
@@ -31,3 +31,7 @@ __exportStar(require("./models/mongodb/index"), exports);
|
|
|
31
31
|
__exportStar(require("./models/psql/index"), exports);
|
|
32
32
|
/************ types *************/
|
|
33
33
|
__exportStar(require("./types/index"), exports);
|
|
34
|
+
/************ validator ********** */
|
|
35
|
+
__exportStar(require("./commonValidator"), exports);
|
|
36
|
+
/************ queues *************/
|
|
37
|
+
__exportStar(require("./queues/index"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|