@kipicore/dbcore 1.1.118 → 1.1.120

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, Sequelize: any): Promise<void>;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('subject_has_fee');
4
+ if (!table.batch_id) {
5
+ await queryInterface.addColumn('subject_has_fee', 'batch_id', {
6
+ type: Sequelize.UUID,
7
+ defaultValue: null,
8
+ allowNull: true,
9
+ field: 'batch_id',
10
+ });
11
+ }
12
+ if (!table.batch_type) {
13
+ await queryInterface.addColumn('subject_has_fee', 'batch_type', {
14
+ type: Sequelize.UUID,
15
+ defaultValue: null,
16
+ allowNull: true,
17
+ field: 'batch_type',
18
+ });
19
+ }
20
+ if (!table.academic_calender_id) {
21
+ await queryInterface.addColumn('subject_has_fee', 'academic_calender_id', {
22
+ type: Sequelize.UUID,
23
+ defaultValue: null,
24
+ allowNull: true,
25
+ field: 'academic_calender_id',
26
+ });
27
+ }
28
+ };
29
+ const down = async (queryInterface, Sequelize) => {
30
+ const table = await queryInterface.describeTable('subject_has_fee');
31
+ if (table.batch_id) {
32
+ await queryInterface.removeColumn('subject_has_fee', 'batch_id');
33
+ }
34
+ if (table.batch_type) {
35
+ await queryInterface.removeColumn('subject_has_fee', 'batch_type');
36
+ }
37
+ if (table.academic_calender_id) {
38
+ await queryInterface.removeColumn('subject_has_fee', 'academic_calender_id');
39
+ }
40
+ };
41
+ module.exports = {
42
+ up,
43
+ down,
44
+ };
@@ -14,6 +14,7 @@ export interface IExamModelAttributes extends IDefaultAttributes, Document {
14
14
  title: string;
15
15
  subTitle?: string;
16
16
  description?: string;
17
+ syllabus?: string;
17
18
  subject: string;
18
19
  fileId?: string;
19
20
  batches: IExamHasBatch[];
@@ -4,4 +4,7 @@ export interface ISubjectHasFeeModelAttributes extends IDefaultAttributes {
4
4
  instituteId: string;
5
5
  subjectId: string;
6
6
  fee: number;
7
+ academicCalenderId?: string;
8
+ batchId?: string;
9
+ batchType?: string;
7
10
  }
@@ -124,6 +124,10 @@ const examModelSchema = new mongoose_1.Schema({
124
124
  type: Number,
125
125
  required: false,
126
126
  },
127
+ syllabus: {
128
+ type: String,
129
+ required: false,
130
+ },
127
131
  instituteId: {
128
132
  type: String,
129
133
  required: false,
@@ -168,7 +172,7 @@ const examModelSchema = new mongoose_1.Schema({
168
172
  },
169
173
  publishDate: {
170
174
  type: Date,
171
- required: false
175
+ required: false,
172
176
  },
173
177
  createdBy: {
174
178
  type: String,
@@ -6,6 +6,9 @@ declare class SubjectHasFeeModel extends Model<ISubjectHasFeeModelAttributes, TS
6
6
  instituteId: string;
7
7
  subjectId: string;
8
8
  fee: number;
9
+ academicCalenderId?: string;
10
+ batchId?: string;
11
+ batchType?: string;
9
12
  createdBy: string;
10
13
  updatedBy: string;
11
14
  deletedBy: string;
@@ -4,7 +4,7 @@ const sequelize_1 = require("sequelize");
4
4
  const index_1 = require("./index");
5
5
  class SubjectHasFeeModel extends sequelize_1.Model {
6
6
  static associate(models) {
7
- const { InstituteModel, InstituteEntityModel, UserModel } = models;
7
+ const { InstituteModel, InstituteEntityModel, UserModel, BatchModel, TypeManagementModel, AcademicCalendarModel } = models;
8
8
  SubjectHasFeeModel.belongsTo(InstituteModel, {
9
9
  foreignKey: {
10
10
  name: 'instituteId',
@@ -27,6 +27,30 @@ class SubjectHasFeeModel extends sequelize_1.Model {
27
27
  foreignKey: 'subjectId',
28
28
  as: 'subjectHasSubjectHasFee',
29
29
  });
30
+ SubjectHasFeeModel.belongsTo(AcademicCalendarModel, {
31
+ foreignKey: { name: 'academicCalenderId', field: 'academic_calender_id' },
32
+ as: 'subHFeeAcaCal',
33
+ });
34
+ AcademicCalendarModel.hasMany(SubjectHasFeeModel, {
35
+ foreignKey: { name: 'academicCalenderId', field: 'academic_calender_id' },
36
+ as: 'acaCalSubHFee',
37
+ });
38
+ SubjectHasFeeModel.belongsTo(BatchModel, {
39
+ foreignKey: { name: 'batchId', field: 'batch_id' },
40
+ as: 'subHFeeBatchDetails',
41
+ });
42
+ BatchModel.hasMany(SubjectHasFeeModel, {
43
+ foreignKey: { name: 'batchId', field: 'batch_id' },
44
+ as: 'batchSubHFee',
45
+ });
46
+ SubjectHasFeeModel.belongsTo(TypeManagementModel, {
47
+ foreignKey: { name: 'batchType', field: 'batch_type' },
48
+ as: 'subHFeeBatchType',
49
+ });
50
+ TypeManagementModel.hasMany(SubjectHasFeeModel, {
51
+ foreignKey: { name: 'batchType', field: 'batch_type' },
52
+ as: 'batchTypeSubHFee',
53
+ });
30
54
  SubjectHasFeeModel.belongsTo(UserModel, {
31
55
  foreignKey: {
32
56
  name: 'createdBy',
@@ -72,6 +96,21 @@ SubjectHasFeeModel.init({
72
96
  type: sequelize_1.DataTypes.INTEGER,
73
97
  allowNull: false,
74
98
  },
99
+ academicCalenderId: {
100
+ type: sequelize_1.DataTypes.UUID,
101
+ field: 'academic_calender_id',
102
+ allowNull: true,
103
+ },
104
+ batchId: {
105
+ type: sequelize_1.DataTypes.UUID,
106
+ field: 'batch_id',
107
+ allowNull: true,
108
+ },
109
+ batchType: {
110
+ type: sequelize_1.DataTypes.UUID,
111
+ field: 'batch_type',
112
+ allowNull: true,
113
+ },
75
114
  }, {
76
115
  modelName: 'SubjectHasFeeModel',
77
116
  tableName: 'subject_has_fee',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.118",
3
+ "version": "1.1.120",
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",