@kipicore/dbcore 1.1.685 → 1.1.686

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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('testimonials');
4
+ if (!table.sports_academy_id) {
5
+ await queryInterface.addColumn('testimonials', 'sports_academy_id', {
6
+ type: Sequelize.STRING,
7
+ allowNull: true,
8
+ field: 'sports_academy_id',
9
+ });
10
+ }
11
+ };
12
+ const down = async (queryInterface) => {
13
+ const table = await queryInterface.describeTable('testimonials');
14
+ if (table.sports_academy_id) {
15
+ await queryInterface.removeColumn('testimonials', 'sports_academy_id');
16
+ }
17
+ };
18
+ module.exports = {
19
+ up,
20
+ down,
21
+ };
@@ -13,5 +13,7 @@ export interface IGalleryAlbumAttributes extends IDefaultAttributes, Document {
13
13
  status: COMMAN_STATUS;
14
14
  instituteId: string;
15
15
  date?: Date;
16
- academicCalendarId: string;
16
+ academicCalendarId?: string;
17
+ sportsAcademyId?: string;
18
+ insId?: string;
17
19
  }
@@ -10,4 +10,5 @@ export interface ITestimonialModelAttributes extends IDefaultAttributes {
10
10
  userType: USER_TYPES;
11
11
  class?: string | null;
12
12
  academicCalendarId?: string;
13
+ sportsAcademyId?: string;
13
14
  }
@@ -72,12 +72,16 @@ const PhotosGalleryModelSchema = new mongoose_1.Schema({
72
72
  },
73
73
  instituteId: {
74
74
  type: String,
75
- required: true,
75
+ required: false,
76
76
  },
77
77
  academicCalendarId: {
78
78
  type: String,
79
79
  required: false,
80
80
  },
81
+ sportsAcademyId: {
82
+ type: String,
83
+ required: false,
84
+ },
81
85
  }, { timestamps: true, versionKey: false });
82
86
  PhotosGalleryModelSchema.index({
83
87
  instituteId: 1,
@@ -12,6 +12,7 @@ declare class TestimonialModel extends Model<ITestimonialModelAttributes, TTesti
12
12
  userType: USER_TYPES;
13
13
  class?: string | null;
14
14
  academicCalendarId?: string;
15
+ sportsAcademyId?: string;
15
16
  createdBy: string;
16
17
  updatedBy: string;
17
18
  deletedBy: string;
@@ -65,7 +65,7 @@ class TestimonialModel extends sequelize_1.Model {
65
65
  const { InstituteModel, UserModel, InstituteEntityModel } = models;
66
66
  const beforeCreateOrUpdateHook = async (testimonial) => {
67
67
  let institute = null;
68
- if (testimonial.instituteId) {
68
+ if (testimonial?.instituteId) {
69
69
  institute = await InstituteModel.findByPk(testimonial.instituteId);
70
70
  if (!institute) {
71
71
  throw new Error(errorMessages_1.INSTITUTE_ERROR_MESSAGES.NOT_FOUND);
@@ -80,7 +80,7 @@ class TestimonialModel extends sequelize_1.Model {
80
80
  testimonial.userType = user.type;
81
81
  }
82
82
  testimonial.class = `${(0, utils_1.fromSnakeCaseToNormalText)(testimonial.userType)}`;
83
- if (testimonial.userId && testimonial.instituteId && testimonial.userType !== app_1.USER_TYPES.PARENTS) {
83
+ if (testimonial.userId && testimonial?.instituteId && testimonial.userType !== app_1.USER_TYPES.PARENTS) {
84
84
  const userInstituteMetaWhere = {
85
85
  userId: testimonial.userId,
86
86
  instituteId: testimonial.instituteId,
@@ -105,11 +105,7 @@ class TestimonialModel extends sequelize_1.Model {
105
105
  association: 'entityType',
106
106
  required: true,
107
107
  where: {
108
- [sequelize_1.Op.or]: [
109
- { title: { [sequelize_1.Op.iLike]: 'STANDARD' } },
110
- { title: { [sequelize_1.Op.iLike]: 'MEDIUM' } },
111
- { title: { [sequelize_1.Op.iLike]: 'SECTIONS' } },
112
- ],
108
+ [sequelize_1.Op.or]: [{ title: { [sequelize_1.Op.iLike]: 'STANDARD' } }, { title: { [sequelize_1.Op.iLike]: 'MEDIUM' } }, { title: { [sequelize_1.Op.iLike]: 'SECTIONS' } }],
113
109
  },
114
110
  },
115
111
  });
@@ -172,6 +168,11 @@ TestimonialModel.init({
172
168
  field: 'academic_calendar_id',
173
169
  allowNull: true,
174
170
  },
171
+ sportsAcademyId: {
172
+ type: sequelize_1.DataTypes.STRING,
173
+ field: 'sports_academy_id',
174
+ allowNull: true,
175
+ },
175
176
  }, {
176
177
  modelName: 'TestimonialModel',
177
178
  tableName: 'testimonials',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.685",
3
+ "version": "1.1.686",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",