@kipicore/dbcore 1.1.719 → 1.1.721
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/joiCommonValidator.d.ts +12 -0
- package/dist/commonValidator/joiCommonValidator.js +22 -1
- package/dist/db/psql/migrations/20260810135826-add_description_to_sport_academy_batches.d.ts +2 -0
- package/dist/db/psql/migrations/20260810135826-add_description_to_sport_academy_batches.js +13 -0
- package/dist/interfaces/sportAcademyBatchInterface.d.ts +1 -0
- package/dist/interfaces/userAmenityInterface.d.ts +1 -0
- package/dist/models/mongodb/userAmenityModel.js +1 -0
- package/dist/models/psql/sportAcademyBatchModel.d.ts +1 -0
- package/dist/models/psql/sportAcademyBatchModel.js +5 -1
- package/package.json +1 -1
|
@@ -7,6 +7,18 @@ export declare const paginationValidators: {
|
|
|
7
7
|
order: Joi.ArraySchema<string[][]>;
|
|
8
8
|
sort: Joi.StringSchema<string>;
|
|
9
9
|
};
|
|
10
|
+
export declare const reportGenerateSchema: {
|
|
11
|
+
startDate: Joi.StringSchema<string>;
|
|
12
|
+
endDate: Joi.StringSchema<string>;
|
|
13
|
+
startTime: Joi.StringSchema<string>;
|
|
14
|
+
endTime: Joi.StringSchema<string>;
|
|
15
|
+
tableTitle: Joi.StringSchema<string>;
|
|
16
|
+
isExportReport: Joi.AlternativesSchema<string | boolean>;
|
|
17
|
+
search: Joi.StringSchema<string>;
|
|
18
|
+
order: Joi.ArraySchema<string[][]>;
|
|
19
|
+
columns: Joi.ArraySchema<any[]>;
|
|
20
|
+
};
|
|
10
21
|
export declare const enumAlternatives: (enumObj: Record<string, string>, isRequired?: boolean, allowArray?: boolean) => Joi.StringSchema<string> | Joi.AlternativesSchema<any>;
|
|
11
22
|
export declare const objectIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
|
|
12
23
|
export declare const uuidIdAlternatives: (isRequired?: boolean, allowArray?: boolean) => Joi.AlternativesSchema<any> | undefined;
|
|
24
|
+
export declare const emailValidator: (isRequired?: boolean) => Joi.StringSchema<string>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.uuidIdAlternatives = exports.objectIdAlternatives = exports.enumAlternatives = exports.paginationValidators = void 0;
|
|
6
|
+
exports.emailValidator = exports.uuidIdAlternatives = exports.objectIdAlternatives = exports.enumAlternatives = exports.reportGenerateSchema = exports.paginationValidators = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
exports.paginationValidators = {
|
|
9
9
|
page: joi_1.default.number().integer().min(1).default(1),
|
|
@@ -18,6 +18,22 @@ exports.paginationValidators = {
|
|
|
18
18
|
'string.pattern.base': `"sort" must be a comma-separated list of field names, optionally prefixed with '-' for descending`,
|
|
19
19
|
}),
|
|
20
20
|
};
|
|
21
|
+
exports.reportGenerateSchema = {
|
|
22
|
+
startDate: joi_1.default.string().optional(),
|
|
23
|
+
endDate: joi_1.default.string().optional(),
|
|
24
|
+
startTime: joi_1.default.string().optional(),
|
|
25
|
+
endTime: joi_1.default.string().optional(),
|
|
26
|
+
tableTitle: joi_1.default.string().trim().optional(),
|
|
27
|
+
isExportReport: joi_1.default.alternatives().try(joi_1.default.boolean(), joi_1.default.string()).optional(),
|
|
28
|
+
search: joi_1.default.string().trim(),
|
|
29
|
+
order: joi_1.default.array().items(joi_1.default.array().items(joi_1.default.string().trim(), joi_1.default.string().trim())),
|
|
30
|
+
columns: joi_1.default.array().items(joi_1.default.object({
|
|
31
|
+
title: joi_1.default.string().optional(),
|
|
32
|
+
field: joi_1.default.alternatives().try(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string()).min(1)).optional(),
|
|
33
|
+
joinContent: joi_1.default.string().optional().default(' '),
|
|
34
|
+
default: joi_1.default.boolean(),
|
|
35
|
+
})),
|
|
36
|
+
};
|
|
21
37
|
const enumAlternatives = (enumObj, isRequired = false, allowArray = true) => {
|
|
22
38
|
const base = joi_1.default.string().valid(...Object.values(enumObj));
|
|
23
39
|
if (allowArray) {
|
|
@@ -45,3 +61,8 @@ const uuidIdAlternatives = (isRequired = false, allowArray = true) => {
|
|
|
45
61
|
}
|
|
46
62
|
};
|
|
47
63
|
exports.uuidIdAlternatives = uuidIdAlternatives;
|
|
64
|
+
const emailValidator = (isRequired = false) => {
|
|
65
|
+
const validator = joi_1.default.string().email().message('Invalid email format');
|
|
66
|
+
return isRequired ? validator.required() : validator.optional();
|
|
67
|
+
};
|
|
68
|
+
exports.emailValidator = emailValidator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
3
|
+
module.exports = {
|
|
4
|
+
async up(queryInterface, Sequelize) {
|
|
5
|
+
await queryInterface.addColumn('sport_academy_batches', 'description', {
|
|
6
|
+
type: Sequelize.TEXT,
|
|
7
|
+
allowNull: true,
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
async down(queryInterface, Sequelize) {
|
|
11
|
+
await queryInterface.removeColumn('sport_academy_batches', 'description');
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -46,6 +46,7 @@ const userAmenitySchema = new mongoose_1.Schema({
|
|
|
46
46
|
country: { type: Number, required: false },
|
|
47
47
|
images: { type: [String], required: false },
|
|
48
48
|
ownerId: { type: String, required: false },
|
|
49
|
+
sportAcademyId: { type: String, required: false },
|
|
49
50
|
facilities: [
|
|
50
51
|
{
|
|
51
52
|
sportId: { type: String, required: true },
|
|
@@ -6,7 +6,7 @@ const index_1 = require("./index");
|
|
|
6
6
|
const app_1 = require("../../constants/app");
|
|
7
7
|
class SportAcademyBatchModel extends sequelize_1.Model {
|
|
8
8
|
static associate(models) {
|
|
9
|
-
const { UserModel, SportModel
|
|
9
|
+
const { UserModel, SportModel } = models;
|
|
10
10
|
SportAcademyBatchModel.belongsTo(SportModel, {
|
|
11
11
|
foreignKey: { name: 'sportId', allowNull: true, field: 'sport_id' },
|
|
12
12
|
as: 'sport',
|
|
@@ -71,6 +71,10 @@ SportAcademyBatchModel.init({
|
|
|
71
71
|
allowNull: true,
|
|
72
72
|
field: 'batch_capacity',
|
|
73
73
|
},
|
|
74
|
+
description: {
|
|
75
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
},
|
|
74
78
|
status: {
|
|
75
79
|
type: sequelize_1.DataTypes.STRING,
|
|
76
80
|
allowNull: true,
|
package/package.json
CHANGED