@kipicore/dbcore 1.1.668 → 1.1.670
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/configs/env.d.ts +0 -2
- package/dist/configs/env.js +0 -4
- package/dist/configs/index.d.ts +0 -2
- package/dist/configs/index.js +0 -2
- package/dist/constants/app.d.ts +13 -20
- package/dist/constants/app.js +23 -31
- package/dist/constants/errorMessages.d.ts +0 -17
- package/dist/constants/errorMessages.js +1 -20
- package/dist/constants/successMessages.d.ts +0 -14
- package/dist/constants/successMessages.js +1 -17
- package/dist/db/psql/migrations/20260714095754-create-arena-models.js +642 -0
- package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +2 -0
- package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +138 -0
- package/dist/helpers/index.d.ts +0 -3
- package/dist/helpers/index.js +0 -3
- package/dist/helpers/utils.d.ts +3 -2
- package/dist/helpers/utils.js +31 -46
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/interfaces/ageGroupInterface.d.ts +12 -0
- package/dist/interfaces/assessmentTestInterface.d.ts +24 -0
- package/dist/interfaces/categoriesInterface.d.ts +1 -2
- package/dist/interfaces/equipmentInterface.d.ts +10 -0
- package/dist/interfaces/equipmentInterface.js +2 -0
- package/dist/interfaces/facilityMasterInterface.d.ts +9 -0
- package/dist/interfaces/facilityMasterInterface.js +2 -0
- package/dist/interfaces/index.d.ts +12 -1
- package/dist/interfaces/index.js +13 -1
- package/dist/interfaces/instituteInterface.d.ts +0 -1
- package/dist/interfaces/skillInterface.d.ts +15 -0
- package/dist/interfaces/skillInterface.js +2 -0
- package/dist/interfaces/sportCategoryInterface.d.ts +9 -0
- package/dist/interfaces/sportCategoryInterface.js +2 -0
- package/dist/interfaces/sportGroupDataInterface.d.ts +7 -0
- package/dist/interfaces/sportGroupDataInterface.js +2 -0
- package/dist/interfaces/sportInfoInterface.d.ts +23 -0
- package/dist/interfaces/sportInfoInterface.js +2 -0
- package/dist/interfaces/sportInterface.d.ts +10 -0
- package/dist/interfaces/sportInterface.js +2 -0
- package/dist/interfaces/sportRoleInterface.d.ts +11 -0
- package/dist/interfaces/sportRoleInterface.js +2 -0
- package/dist/interfaces/sportSubCategoryInterface.d.ts +10 -0
- package/dist/interfaces/sportSubCategoryInterface.js +2 -0
- package/dist/interfaces/subCategoriesInterface.d.ts +1 -2
- package/dist/interfaces/subscriptionPlanInterface.d.ts +1 -2
- package/dist/interfaces/unitInterface.d.ts +10 -0
- package/dist/interfaces/unitInterface.js +2 -0
- package/dist/interfaces/userInterface.d.ts +1 -2
- package/dist/interfaces/vendorCompanyMetaInterface.d.ts +1 -2
- package/dist/models/mongodb/assessmentTestModel.d.ts +4 -0
- package/dist/models/mongodb/assessmentTestModel.js +72 -0
- package/dist/models/mongodb/index.d.ts +2 -0
- package/dist/models/mongodb/index.js +6 -1
- package/dist/models/mongodb/productMetaModel.js +0 -8
- package/dist/models/mongodb/sportInfoModel.d.ts +4 -0
- package/dist/models/mongodb/sportInfoModel.js +71 -0
- package/dist/models/mongodb/subscriptionPlanModel.js +0 -5
- package/dist/models/mongodb/vendorCompanyMetaModel.js +1 -6
- package/dist/models/psql/SubCategoriesModel.d.ts +1 -2
- package/dist/models/psql/SubCategoriesModel.js +0 -5
- package/dist/models/psql/ageGroupModel.d.ts +22 -0
- package/dist/models/psql/ageGroupModel.js +76 -0
- package/dist/models/psql/categoriesModel.d.ts +1 -2
- package/dist/models/psql/categoriesModel.js +0 -5
- package/dist/models/psql/equipmentModel.d.ts +20 -0
- package/dist/models/psql/equipmentModel.js +57 -0
- package/dist/models/psql/facilityMasterModel.d.ts +18 -0
- package/dist/models/psql/facilityMasterModel.js +64 -0
- package/dist/models/psql/fileStorageModel.js +4 -3
- package/dist/models/psql/index.d.ts +10 -1
- package/dist/models/psql/index.js +23 -4
- package/dist/models/psql/instituteModel.d.ts +0 -1
- package/dist/models/psql/instituteModel.js +2 -5
- package/dist/models/psql/skillModel.d.ts +25 -0
- package/dist/models/psql/skillModel.js +99 -0
- package/dist/models/psql/sportCategoryModel.d.ts +19 -0
- package/dist/models/psql/sportCategoryModel.js +53 -0
- package/dist/models/psql/sportGroupDataModel.d.ts +13 -0
- package/dist/models/psql/sportGroupDataModel.js +64 -0
- package/dist/models/psql/sportModel.d.ts +20 -0
- package/dist/models/psql/sportModel.js +58 -0
- package/dist/models/psql/sportRoleModel.d.ts +21 -0
- package/dist/models/psql/sportRoleModel.js +71 -0
- package/dist/models/psql/sportSubCategoryModel.d.ts +20 -0
- package/dist/models/psql/sportSubCategoryModel.js +75 -0
- package/dist/models/psql/unitModel.d.ts +20 -0
- package/dist/models/psql/unitModel.js +57 -0
- package/dist/models/psql/userModel.d.ts +1 -2
- package/dist/models/psql/userModel.js +0 -1
- package/dist/types/ageGroupType.d.ts +2 -0
- package/dist/types/ageGroupType.js +2 -0
- package/dist/types/assessmentTestType.d.ts +2 -0
- package/dist/types/assessmentTestType.js +2 -0
- package/dist/types/commonType.d.ts +1 -20
- package/dist/types/equipmentType.d.ts +2 -0
- package/dist/types/equipmentType.js +2 -0
- package/dist/types/facilityMasterType.d.ts +3 -0
- package/dist/types/facilityMasterType.js +2 -0
- package/dist/types/index.d.ts +12 -1
- package/dist/types/index.js +13 -1
- package/dist/types/skillType.d.ts +2 -0
- package/dist/types/skillType.js +2 -0
- package/dist/types/sportCategoryType.d.ts +2 -0
- package/dist/types/sportCategoryType.js +2 -0
- package/dist/types/sportGroupDataType.d.ts +3 -0
- package/dist/types/sportGroupDataType.js +2 -0
- package/dist/types/sportInfoType.d.ts +2 -0
- package/dist/types/sportInfoType.js +2 -0
- package/dist/types/sportRoleType.d.ts +2 -0
- package/dist/types/sportRoleType.js +2 -0
- package/dist/types/sportSubCategoryType.d.ts +2 -0
- package/dist/types/sportSubCategoryType.js +2 -0
- package/dist/types/sportType.d.ts +2 -0
- package/dist/types/sportType.js +2 -0
- package/dist/types/unitType.d.ts +2 -0
- package/dist/types/unitType.js +2 -0
- package/package.json +3 -11
- package/dist/commonValidator/commandValidator.d.ts +0 -27
- package/dist/commonValidator/commandValidator.js +0 -225
- package/dist/commonValidator/index.d.ts +0 -3
- package/dist/commonValidator/index.js +0 -24
- package/dist/commonValidator/joiCommonValidator.d.ts +0 -12
- package/dist/commonValidator/joiCommonValidator.js +0 -47
- package/dist/commonValidator/joiSchemaBuilder.d.ts +0 -6
- package/dist/commonValidator/joiSchemaBuilder.js +0 -70
- package/dist/configs/logger.d.ts +0 -2
- package/dist/configs/logger.js +0 -44
- package/dist/configs/redisConfig.d.ts +0 -4
- package/dist/configs/redisConfig.js +0 -32
- package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +0 -46
- package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.d.ts +0 -2
- package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +0 -20
- package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.d.ts +0 -2
- package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +0 -156
- package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +0 -2
- package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +0 -19
- package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +0 -2
- package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +0 -19
- package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +0 -2
- package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +0 -19
- package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.d.ts +0 -2
- package/dist/db/psql/migrations/20260721000001-add-deleted-at-to-rms-maintenance-activities.js +0 -12
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.d.ts +0 -2
- package/dist/db/psql/migrations/20260721000002-change-uploaded-from-enum-to-string-in-file-storage.js +0 -42
- package/dist/helpers/sendEmail.d.ts +0 -3
- package/dist/helpers/sendEmail.js +0 -117
- package/dist/helpers/sendNotification.d.ts +0 -4
- package/dist/helpers/sendNotification.js +0 -34
- package/dist/helpers/sendSMS.d.ts +0 -5
- package/dist/helpers/sendSMS.js +0 -34
- package/dist/interfaces/aiModelKeysInterface.d.ts +0 -15
- package/dist/models/psql/aiModelKeysModel.d.ts +0 -20
- package/dist/models/psql/aiModelKeysModel.js +0 -70
- package/dist/queues/emailQueue.d.ts +0 -3
- package/dist/queues/emailQueue.js +0 -22
- package/dist/queues/emailWorker.d.ts +0 -3
- package/dist/queues/emailWorker.js +0 -33
- package/dist/queues/index.d.ts +0 -2
- package/dist/queues/index.js +0 -18
- package/dist/types/aiModelKeysType.d.ts +0 -3
- /package/dist/db/psql/migrations/{20260714111425-change_status_enum_to_string_in_institutes.d.ts → 20260714095754-create-arena-models.d.ts} +0 -0
- /package/dist/interfaces/{aiModelKeysInterface.js → ageGroupInterface.js} +0 -0
- /package/dist/{types/aiModelKeysType.js → interfaces/assessmentTestInterface.js} +0 -0
package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
3
|
+
module.exports = {
|
|
4
|
+
async up(queryInterface, Sequelize) {
|
|
5
|
+
await queryInterface.dropTable('facility_sports');
|
|
6
|
+
await queryInterface.createTable('sport_group_data', {
|
|
7
|
+
id: {
|
|
8
|
+
allowNull: false,
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
defaultValue: Sequelize.UUIDV4
|
|
12
|
+
},
|
|
13
|
+
sport_id: {
|
|
14
|
+
type: Sequelize.UUID,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
references: {
|
|
17
|
+
model: 'sports',
|
|
18
|
+
key: 'id'
|
|
19
|
+
},
|
|
20
|
+
onUpdate: 'CASCADE',
|
|
21
|
+
onDelete: 'CASCADE'
|
|
22
|
+
},
|
|
23
|
+
facility_id: {
|
|
24
|
+
type: Sequelize.UUID,
|
|
25
|
+
allowNull: true,
|
|
26
|
+
references: {
|
|
27
|
+
model: 'facility_masters',
|
|
28
|
+
key: 'id'
|
|
29
|
+
},
|
|
30
|
+
onUpdate: 'CASCADE',
|
|
31
|
+
onDelete: 'CASCADE'
|
|
32
|
+
},
|
|
33
|
+
equipment_id: {
|
|
34
|
+
type: Sequelize.UUID,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
references: {
|
|
37
|
+
model: 'equipments',
|
|
38
|
+
key: 'id'
|
|
39
|
+
},
|
|
40
|
+
onUpdate: 'CASCADE',
|
|
41
|
+
onDelete: 'CASCADE'
|
|
42
|
+
},
|
|
43
|
+
createdAt: {
|
|
44
|
+
allowNull: false,
|
|
45
|
+
type: Sequelize.DATE,
|
|
46
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
47
|
+
field: 'created_at',
|
|
48
|
+
},
|
|
49
|
+
updatedAt: {
|
|
50
|
+
allowNull: false,
|
|
51
|
+
type: Sequelize.DATE,
|
|
52
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
53
|
+
field: 'updated_at',
|
|
54
|
+
},
|
|
55
|
+
deletedAt: {
|
|
56
|
+
type: Sequelize.DATE,
|
|
57
|
+
field: 'deleted_at',
|
|
58
|
+
},
|
|
59
|
+
createdBy: {
|
|
60
|
+
type: Sequelize.UUID,
|
|
61
|
+
allowNull: true,
|
|
62
|
+
field: 'created_by',
|
|
63
|
+
},
|
|
64
|
+
updatedBy: {
|
|
65
|
+
type: Sequelize.UUID,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
field: 'updated_by',
|
|
68
|
+
},
|
|
69
|
+
deletedBy: {
|
|
70
|
+
type: Sequelize.UUID,
|
|
71
|
+
allowNull: true,
|
|
72
|
+
field: 'deleted_by',
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
async down(queryInterface, Sequelize) {
|
|
77
|
+
await queryInterface.dropTable('sport_group_data');
|
|
78
|
+
await queryInterface.createTable('facility_sports', {
|
|
79
|
+
id: {
|
|
80
|
+
allowNull: false,
|
|
81
|
+
primaryKey: true,
|
|
82
|
+
type: Sequelize.UUID,
|
|
83
|
+
defaultValue: Sequelize.UUIDV4
|
|
84
|
+
},
|
|
85
|
+
facility_id: {
|
|
86
|
+
type: Sequelize.UUID,
|
|
87
|
+
allowNull: false,
|
|
88
|
+
references: {
|
|
89
|
+
model: 'facility_masters',
|
|
90
|
+
key: 'id'
|
|
91
|
+
},
|
|
92
|
+
onUpdate: 'CASCADE',
|
|
93
|
+
onDelete: 'CASCADE'
|
|
94
|
+
},
|
|
95
|
+
sport_id: {
|
|
96
|
+
type: Sequelize.UUID,
|
|
97
|
+
allowNull: false,
|
|
98
|
+
references: {
|
|
99
|
+
model: 'sports',
|
|
100
|
+
key: 'id'
|
|
101
|
+
},
|
|
102
|
+
onUpdate: 'CASCADE',
|
|
103
|
+
onDelete: 'CASCADE'
|
|
104
|
+
},
|
|
105
|
+
createdAt: {
|
|
106
|
+
allowNull: false,
|
|
107
|
+
type: Sequelize.DATE,
|
|
108
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
109
|
+
field: 'created_at',
|
|
110
|
+
},
|
|
111
|
+
updatedAt: {
|
|
112
|
+
allowNull: false,
|
|
113
|
+
type: Sequelize.DATE,
|
|
114
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
|
115
|
+
field: 'updated_at',
|
|
116
|
+
},
|
|
117
|
+
deletedAt: {
|
|
118
|
+
type: Sequelize.DATE,
|
|
119
|
+
field: 'deleted_at',
|
|
120
|
+
},
|
|
121
|
+
createdBy: {
|
|
122
|
+
type: Sequelize.UUID,
|
|
123
|
+
allowNull: true,
|
|
124
|
+
field: 'created_by',
|
|
125
|
+
},
|
|
126
|
+
updatedBy: {
|
|
127
|
+
type: Sequelize.UUID,
|
|
128
|
+
allowNull: true,
|
|
129
|
+
field: 'updated_by',
|
|
130
|
+
},
|
|
131
|
+
deletedBy: {
|
|
132
|
+
type: Sequelize.UUID,
|
|
133
|
+
allowNull: true,
|
|
134
|
+
field: 'deleted_by',
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -16,6 +16,3 @@ 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);
|
package/dist/helpers/utils.d.ts
CHANGED
|
@@ -156,6 +156,9 @@ export declare function extractFromObject(data: any[], config: {
|
|
|
156
156
|
userdata: any[];
|
|
157
157
|
columns: string[];
|
|
158
158
|
};
|
|
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;
|
|
159
162
|
export declare const customPagination: <T>(data: T[], page: number, limit: number, totalRecords: number) => Promise<{
|
|
160
163
|
limit: number;
|
|
161
164
|
totalRecords: number;
|
|
@@ -176,6 +179,4 @@ export declare const calculateGrade: (subject: {
|
|
|
176
179
|
obtained: number;
|
|
177
180
|
}) => GRADE;
|
|
178
181
|
export declare const getOverallGrade: (subjects: Subject[]) => GRADE;
|
|
179
|
-
export declare const readEmailTemplate: (templateName: string) => Promise<string>;
|
|
180
|
-
export declare const readEmailTemplateWithOutGlobal: (data: any, templateName?: string) => Promise<string>;
|
|
181
182
|
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.getOverallGrade = exports.calculateGrade = exports.getNextLetter = exports.getCityAreas = exports.generateVoucherCode = exports.verifyHmacSHA256 = exports.generateHmacSHA256 = exports.customPagination = exports.uuidIdAlternatives = exports.objectIdAlternatives = exports.enumAlternatives = 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,8 +51,6 @@ 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"));
|
|
56
54
|
const PASSWORD_REGEX = new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!.@#$%^&*])(?=.{8,})');
|
|
57
55
|
const pick = (objOrArray, keys) => {
|
|
58
56
|
const pickObject = (obj) => keys.reduce((acc, key) => {
|
|
@@ -508,10 +506,9 @@ const parseOrderOptions = (inputOrder, defaultOrder = [['createdAt', 'DESC']]) =
|
|
|
508
506
|
return order;
|
|
509
507
|
};
|
|
510
508
|
exports.parseOrderOptions = parseOrderOptions;
|
|
511
|
-
const configs_1 = require("../configs");
|
|
512
509
|
const capitalizeFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
513
510
|
exports.capitalizeFirst = capitalizeFirst;
|
|
514
|
-
const normalizeToArray = (value) =>
|
|
511
|
+
const normalizeToArray = (value) => value ? (Array.isArray(value) ? value : [value]) : undefined;
|
|
515
512
|
exports.normalizeToArray = normalizeToArray;
|
|
516
513
|
/**
|
|
517
514
|
* Converts a snake_case string to Normal Text
|
|
@@ -544,7 +541,8 @@ function assignNonNull(target, source) {
|
|
|
544
541
|
});
|
|
545
542
|
}
|
|
546
543
|
function isUserSchoolInfoUpdate(institute, reqUser) {
|
|
547
|
-
return !!(institute.type || institute.subType) &&
|
|
544
|
+
return (!!(institute.type || institute.subType) &&
|
|
545
|
+
(reqUser.isAddDetails || reqUser.type === app_1.USER_TYPES.INSTITUTE_MASTER_ADMIN || reqUser.type === app_1.USER_TYPES.INSTITUTE_ADMIN));
|
|
548
546
|
}
|
|
549
547
|
function chunkArray(array, size) {
|
|
550
548
|
const chunks = [];
|
|
@@ -616,6 +614,33 @@ function extractFromObject(data, config) {
|
|
|
616
614
|
});
|
|
617
615
|
return { tableTitle: config.tableTitle, userdata, columns };
|
|
618
616
|
}
|
|
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;
|
|
619
644
|
const customPagination = async (data, page, limit, totalRecords) => {
|
|
620
645
|
page = Math.max(1, page || app_1.PAGINATION.PAGE);
|
|
621
646
|
limit = Math.max(1, limit || app_1.PAGINATION.LIMIT);
|
|
@@ -736,43 +761,3 @@ const getOverallGrade = (subjects) => {
|
|
|
736
761
|
return worstGrade;
|
|
737
762
|
};
|
|
738
763
|
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;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,3 @@ 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,7 +31,3 @@ __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,12 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface IAgeGroupModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
sportId?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
code: string;
|
|
8
|
+
minAge?: number;
|
|
9
|
+
maxAge?: number;
|
|
10
|
+
description?: string;
|
|
11
|
+
status: COMMAN_STATUS;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Document } from 'mongoose';
|
|
2
|
+
import { ASSESSMENT_TEST_STATUS } from '../constants/app';
|
|
3
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
4
|
+
export interface IAssessmentTestTargetSkill {
|
|
5
|
+
skillId: string;
|
|
6
|
+
ageGroupId?: string;
|
|
7
|
+
minValue?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IAssessmentTestModelAttributes extends IDefaultAttributes, Document {
|
|
10
|
+
id: string;
|
|
11
|
+
sportId?: string;
|
|
12
|
+
sportRoleId?: string;
|
|
13
|
+
ageGroupId?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
code: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
passingRules?: string;
|
|
18
|
+
scoreFormula?: string;
|
|
19
|
+
documents?: string[];
|
|
20
|
+
videos?: string[];
|
|
21
|
+
targetSkills?: IAssessmentTestTargetSkill[];
|
|
22
|
+
requiredEquipment?: string[];
|
|
23
|
+
status: ASSESSMENT_TEST_STATUS;
|
|
24
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IDefaultAttributes } from './commonInterface';
|
|
2
|
-
import {
|
|
2
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
3
3
|
export interface ICategoriesModelAttributes extends IDefaultAttributes {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
6
|
status: COMMAN_STATUS;
|
|
7
7
|
instituteId?: string;
|
|
8
|
-
type?: CATEGORY_TYPE;
|
|
9
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface IEquipmentModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
status: COMMAN_STATUS;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { COMMAN_STATUS, FACILITY_PLACE_TYPE } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface IFacilityMasterModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
type: FACILITY_PLACE_TYPE;
|
|
8
|
+
status: COMMAN_STATUS;
|
|
9
|
+
}
|
|
@@ -244,7 +244,6 @@ export * from './userFinalResultInterface';
|
|
|
244
244
|
export * from './refundInterface';
|
|
245
245
|
export * from './kipiverseContactFormInterface';
|
|
246
246
|
export * from './moduleDocsInterface';
|
|
247
|
-
export * from './aiModelKeysInterface';
|
|
248
247
|
export * from './accountFinancialYearInterface';
|
|
249
248
|
export * from './accountPeriodLockInterface';
|
|
250
249
|
export * from './accountNumberSequenceInterface';
|
|
@@ -255,3 +254,15 @@ export * from './accountCostCenterInterface';
|
|
|
255
254
|
export * from './accountVoucherTypeInterface';
|
|
256
255
|
export * from './vendorCompanyMetaInterface';
|
|
257
256
|
export * from './productMetaInterface';
|
|
257
|
+
export * from './sportInterface';
|
|
258
|
+
export * from './sportCategoryInterface';
|
|
259
|
+
export * from './sportSubCategoryInterface';
|
|
260
|
+
export * from './sportRoleInterface';
|
|
261
|
+
export * from './equipmentInterface';
|
|
262
|
+
export * from './facilityMasterInterface';
|
|
263
|
+
export * from './sportGroupDataInterface';
|
|
264
|
+
export * from './unitInterface';
|
|
265
|
+
export * from './skillInterface';
|
|
266
|
+
export * from './ageGroupInterface';
|
|
267
|
+
export * from './assessmentTestInterface';
|
|
268
|
+
export * from './sportInfoInterface';
|
package/dist/interfaces/index.js
CHANGED
|
@@ -260,7 +260,6 @@ __exportStar(require("./userFinalResultInterface"), exports);
|
|
|
260
260
|
__exportStar(require("./refundInterface"), exports);
|
|
261
261
|
__exportStar(require("./kipiverseContactFormInterface"), exports);
|
|
262
262
|
__exportStar(require("./moduleDocsInterface"), exports);
|
|
263
|
-
__exportStar(require("./aiModelKeysInterface"), exports);
|
|
264
263
|
__exportStar(require("./accountFinancialYearInterface"), exports);
|
|
265
264
|
__exportStar(require("./accountPeriodLockInterface"), exports);
|
|
266
265
|
__exportStar(require("./accountNumberSequenceInterface"), exports);
|
|
@@ -271,3 +270,16 @@ __exportStar(require("./accountCostCenterInterface"), exports);
|
|
|
271
270
|
__exportStar(require("./accountVoucherTypeInterface"), exports);
|
|
272
271
|
__exportStar(require("./vendorCompanyMetaInterface"), exports);
|
|
273
272
|
__exportStar(require("./productMetaInterface"), exports);
|
|
273
|
+
// Arena Module
|
|
274
|
+
__exportStar(require("./sportInterface"), exports);
|
|
275
|
+
__exportStar(require("./sportCategoryInterface"), exports);
|
|
276
|
+
__exportStar(require("./sportSubCategoryInterface"), exports);
|
|
277
|
+
__exportStar(require("./sportRoleInterface"), exports);
|
|
278
|
+
__exportStar(require("./equipmentInterface"), exports);
|
|
279
|
+
__exportStar(require("./facilityMasterInterface"), exports);
|
|
280
|
+
__exportStar(require("./sportGroupDataInterface"), exports);
|
|
281
|
+
__exportStar(require("./unitInterface"), exports);
|
|
282
|
+
__exportStar(require("./skillInterface"), exports);
|
|
283
|
+
__exportStar(require("./ageGroupInterface"), exports);
|
|
284
|
+
__exportStar(require("./assessmentTestInterface"), exports);
|
|
285
|
+
__exportStar(require("./sportInfoInterface"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BETTER_VALUE_TYPE, COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface ISkillModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
sportId?: string;
|
|
6
|
+
unitId?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
code: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
minValue?: number;
|
|
11
|
+
maxValue?: number;
|
|
12
|
+
betterValueType?: BETTER_VALUE_TYPE;
|
|
13
|
+
valueSide?: string[];
|
|
14
|
+
status: COMMAN_STATUS;
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface ISportCategoryModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
status: COMMAN_STATUS;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Document } from 'mongoose';
|
|
2
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
3
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
4
|
+
export interface ISportInfoSkill {
|
|
5
|
+
ageGroupId: string;
|
|
6
|
+
skillId: string;
|
|
7
|
+
minValue?: number;
|
|
8
|
+
maxValue?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ISportInfoModelAttributes extends IDefaultAttributes, Document {
|
|
11
|
+
sportId: string;
|
|
12
|
+
setupGuide?: string;
|
|
13
|
+
images?: string[];
|
|
14
|
+
documents?: string[];
|
|
15
|
+
categories?: string[];
|
|
16
|
+
subCategories?: string[];
|
|
17
|
+
equipments?: string[];
|
|
18
|
+
amenitiesNeeded?: string[];
|
|
19
|
+
infrastructure?: string[];
|
|
20
|
+
specificTests?: string[];
|
|
21
|
+
skills?: ISportInfoSkill[];
|
|
22
|
+
status: COMMAN_STATUS;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface ISportModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
status: COMMAN_STATUS;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface ISportRoleModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
sportId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
code: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
status: COMMAN_STATUS;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface ISportSubCategoryModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
sportId: string;
|
|
6
|
+
categoryId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
code: string;
|
|
9
|
+
status: COMMAN_STATUS;
|
|
10
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { IDefaultAttributes } from './commonInterface';
|
|
2
|
-
import {
|
|
2
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
3
3
|
export interface ISubCategoriesModelAttributes extends IDefaultAttributes {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
6
|
categoryId: string;
|
|
7
7
|
instituteId?: string;
|
|
8
8
|
status: COMMAN_STATUS;
|
|
9
|
-
type: CATEGORY_TYPE;
|
|
10
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from 'mongoose';
|
|
2
|
-
import { APP_TYPE, COMMAN_STATUS, SUBSCRIPTION_PLAN_CHARGE_INTERVAL, DISCOUNT_TYPE, SUBSCRIPTION_PLAN_FILES_TYPE, VALID_CURRENCY, USER_TYPES, SUBSCRIPTION_PLAN_TYPE
|
|
2
|
+
import { APP_TYPE, COMMAN_STATUS, SUBSCRIPTION_PLAN_CHARGE_INTERVAL, DISCOUNT_TYPE, SUBSCRIPTION_PLAN_FILES_TYPE, VALID_CURRENCY, USER_TYPES, SUBSCRIPTION_PLAN_TYPE } from '../constants/app';
|
|
3
3
|
import { IDefaultAttributes } from './commonInterface';
|
|
4
4
|
export interface ISubscriptionPlanFiles {
|
|
5
5
|
type: SUBSCRIPTION_PLAN_FILES_TYPE;
|
|
@@ -33,5 +33,4 @@ export interface ISubscriptionPlanModelAttributes extends IDefaultAttributes, Do
|
|
|
33
33
|
maxFreeCourses?: number;
|
|
34
34
|
maxFreeCoursePrice?: number;
|
|
35
35
|
maxNumberOfSchool?: number;
|
|
36
|
-
sellStatus?: PLAN_SELL_STATUS;
|
|
37
36
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { COMMAN_STATUS } from '../constants/app';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface IUnitModelAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
symbol: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
status: COMMAN_STATUS;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APP_TYPE, EMAIL_VERIFICATION, MOBILE_VERIFICATION,
|
|
1
|
+
import { APP_TYPE, EMAIL_VERIFICATION, MOBILE_VERIFICATION, USER_TYPES } from '../constants/app';
|
|
2
2
|
import { IDefaultAttributes } from './commonInterface';
|
|
3
3
|
export interface IUserAttributes extends IDefaultAttributes {
|
|
4
4
|
id: string;
|
|
@@ -42,5 +42,4 @@ export interface IUserAttributes extends IDefaultAttributes {
|
|
|
42
42
|
district?: string;
|
|
43
43
|
area?: string;
|
|
44
44
|
taluka?: string;
|
|
45
|
-
status?: USER_STATUS;
|
|
46
45
|
}
|
|
@@ -28,7 +28,7 @@ export interface IVendorCompanyMetaAttributes extends IDefaultAttributes, Docume
|
|
|
28
28
|
logo?: string;
|
|
29
29
|
banner?: string;
|
|
30
30
|
address1: string;
|
|
31
|
-
address2
|
|
31
|
+
address2: string;
|
|
32
32
|
area: string;
|
|
33
33
|
district?: string;
|
|
34
34
|
pinCode: string;
|
|
@@ -40,5 +40,4 @@ export interface IVendorCompanyMetaAttributes extends IDefaultAttributes, Docume
|
|
|
40
40
|
description?: string;
|
|
41
41
|
documents: ICompanyDocument[];
|
|
42
42
|
bankDetails: IBankDetails;
|
|
43
|
-
isActive?: boolean;
|
|
44
43
|
}
|