@kipicore/dbcore 1.1.209 → 1.1.211

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,32 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('student_fee_history');
4
+ // Check if column already exists
5
+ if (!table.fee_type_id) {
6
+ await queryInterface.sequelize.query(`
7
+ UPDATE student_fee_history
8
+ SET fee_type_id = fee_type_id[1]
9
+ WHERE fee_type_id IS NOT NULL
10
+ AND array_length(fee_type_id, 1) > 0;
11
+ `);
12
+ // 2. Change column type to UUID
13
+ await queryInterface.changeColumn('student_fee_history', 'fee_type_id', {
14
+ type: Sequelize.UUID,
15
+ allowNull: true,
16
+ });
17
+ }
18
+ };
19
+ const down = async (queryInterface, Sequelize) => {
20
+ const table = await queryInterface.describeTable('student_fee_history');
21
+ // Remove only if column exists
22
+ if (table.fee_type_id) {
23
+ await queryInterface.changeColumn('student_fee_history', 'fee_type_id', {
24
+ type: Sequelize.ARRAY(Sequelize.STRING),
25
+ allowNull: true,
26
+ });
27
+ }
28
+ };
29
+ module.exports = {
30
+ up,
31
+ down,
32
+ };
@@ -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,35 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('student_fee_type_collection');
4
+ // Check if column already exists
5
+ if (!table.subject_id) {
6
+ await queryInterface.addColumn('student_fee_type_collection', 'subject_id', {
7
+ type: Sequelize.UUID,
8
+ defaultValue: null,
9
+ allowNull: true,
10
+ field: 'subject_id',
11
+ });
12
+ }
13
+ if (!table.batch_id) {
14
+ await queryInterface.addColumn('student_fee_type_collection', 'batch_id', {
15
+ type: Sequelize.UUID,
16
+ defaultValue: null,
17
+ allowNull: true,
18
+ field: 'batch_id',
19
+ });
20
+ }
21
+ };
22
+ const down = async (queryInterface, Sequelize) => {
23
+ const table = await queryInterface.describeTable('student_fee_type_collection');
24
+ // Remove only if column exists
25
+ if (table.subject_id) {
26
+ await queryInterface.removeColumn('student_fee_type_collection', 'subject_id');
27
+ }
28
+ if (table.batch_id) {
29
+ await queryInterface.removeColumn('student_fee_type_collection', 'batch_id');
30
+ }
31
+ };
32
+ module.exports = {
33
+ up,
34
+ down,
35
+ };
@@ -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,35 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('student_fee_history');
4
+ // Check if column already exists
5
+ if (!table.subject_id) {
6
+ await queryInterface.addColumn('student_fee_history', 'subject_id', {
7
+ type: Sequelize.UUID,
8
+ defaultValue: null,
9
+ allowNull: true,
10
+ field: 'subject_id',
11
+ });
12
+ }
13
+ if (!table.batch_id) {
14
+ await queryInterface.addColumn('student_fee_history', 'batch_id', {
15
+ type: Sequelize.UUID,
16
+ defaultValue: null,
17
+ allowNull: true,
18
+ field: 'batch_id',
19
+ });
20
+ }
21
+ };
22
+ const down = async (queryInterface, Sequelize) => {
23
+ const table = await queryInterface.describeTable('student_fee_history');
24
+ // Remove only if column exists
25
+ if (table.subject_id) {
26
+ await queryInterface.removeColumn('student_fee_history', 'subject_id');
27
+ }
28
+ if (table.batch_id) {
29
+ await queryInterface.removeColumn('student_fee_history', 'batch_id');
30
+ }
31
+ };
32
+ module.exports = {
33
+ up,
34
+ down,
35
+ };
@@ -9,7 +9,9 @@ export interface IStudentFeeHistoryModelAttributes extends IDefaultAttributes {
9
9
  paymentType: PAYMENT_TYPE;
10
10
  paidFee: number;
11
11
  status: FEE_HISTORY_STATUS;
12
- feeTypeId?: string[];
12
+ feeTypeId?: string;
13
+ subjectId?: string;
14
+ batchId?: string;
13
15
  bankAccountId?: string;
14
16
  invoicePdf?: string;
15
17
  invoiceNumber?: string;
@@ -6,7 +6,9 @@ export interface IStudentFeeTypeCollectionModelAttributes extends IDefaultAttrib
6
6
  userId: string;
7
7
  academicCalendarId: string;
8
8
  studentFeeCollectionId: string;
9
- feeTypeId: string;
9
+ feeTypeId?: string;
10
+ subjectId?: string;
11
+ batchId?: string;
10
12
  amount: number;
11
13
  status: STUDENT_FEE_COLLECTION_STATUS;
12
14
  paidAmount: number;
@@ -5,7 +5,7 @@ export interface ITaskConversationsAttributes {
5
5
  messageId?: string;
6
6
  userId: string;
7
7
  message: string;
8
- parentId?: mongoose.Types.ObjectId;
8
+ parentId?: string;
9
9
  createdAt?: Date;
10
10
  updatedAt?: Date;
11
11
  }
@@ -56,7 +56,7 @@ const TaskConversationsSchema = new mongoose_1.Schema({
56
56
  required: true,
57
57
  },
58
58
  parentId: {
59
- type: mongoose_1.default.Schema.Types.ObjectId,
59
+ type: String,
60
60
  required: false,
61
61
  },
62
62
  createdAt: {
@@ -11,7 +11,7 @@ export declare class StudentFeeHistoryModel extends Model<IStudentFeeHistoryMode
11
11
  paymentType: PAYMENT_TYPE;
12
12
  paidFee: number;
13
13
  status: FEE_HISTORY_STATUS;
14
- feeTypeId?: string[];
14
+ feeTypeId?: string;
15
15
  bankAccountId?: string;
16
16
  invoicePdf?: string;
17
17
  invoiceNumber?: string;
@@ -22,6 +22,8 @@ export declare class StudentFeeHistoryModel extends Model<IStudentFeeHistoryMode
22
22
  upiId?: string;
23
23
  bankName?: string;
24
24
  chequeNo?: string;
25
+ batchId: string;
26
+ subjectId: string;
25
27
  createdBy: string;
26
28
  updatedBy: string;
27
29
  deletedBy: string;
@@ -6,7 +6,7 @@ const index_1 = require("./index");
6
6
  const constants_1 = require("../../constants");
7
7
  class StudentFeeHistoryModel extends sequelize_1.Model {
8
8
  static associate(models) {
9
- const { UserModel, InstituteModel, StudentFeeCollectionModel, FileStorageModel, BankAccountDetailsModel, AcademicCalendarModel } = models;
9
+ const { UserModel, InstituteModel, StudentFeeCollectionModel, FileStorageModel, BankAccountDetailsModel, AcademicCalendarModel, FeeTypeModel, BatchModel, InstituteEntityModel, } = models;
10
10
  StudentFeeHistoryModel.belongsTo(StudentFeeCollectionModel, {
11
11
  foreignKey: { name: 'studentFeeCollectionId', field: 'student_fee_collection_id', allowNull: true },
12
12
  as: 'feeHistoryCollection',
@@ -63,6 +63,14 @@ class StudentFeeHistoryModel extends sequelize_1.Model {
63
63
  foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
64
64
  as: 'acaCalStudentFeeHistory',
65
65
  });
66
+ StudentFeeHistoryModel.belongsTo(FeeTypeModel, {
67
+ foreignKey: { name: 'feeTypeId', field: 'feeType_id' },
68
+ as: 'studentFeeHistoryFeeType',
69
+ });
70
+ FeeTypeModel.hasMany(StudentFeeHistoryModel, {
71
+ foreignKey: { name: 'feeTypeId', field: 'feeType_id' },
72
+ as: 'feeTypeStudentFeeHistory',
73
+ });
66
74
  StudentFeeHistoryModel.belongsTo(UserModel, {
67
75
  foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
68
76
  as: 'createdByUser',
@@ -75,6 +83,22 @@ class StudentFeeHistoryModel extends sequelize_1.Model {
75
83
  foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
76
84
  as: 'deletedByUser',
77
85
  });
86
+ StudentFeeHistoryModel.belongsTo(InstituteEntityModel, {
87
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
88
+ as: 'studentHistorySubject',
89
+ });
90
+ InstituteEntityModel.hasMany(StudentFeeHistoryModel, {
91
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
92
+ as: 'subjectStudentHistory',
93
+ });
94
+ StudentFeeHistoryModel.belongsTo(BatchModel, {
95
+ foreignKey: { name: 'batchId', field: 'batch_id' },
96
+ as: 'studentHistoryBatch',
97
+ });
98
+ BatchModel.hasMany(StudentFeeHistoryModel, {
99
+ foreignKey: { name: 'batchId', field: 'batch_id' },
100
+ as: 'batchStudentHistory',
101
+ });
78
102
  }
79
103
  static addHooks(models) {
80
104
  StudentFeeHistoryModel.beforeCreate(async (feeCollection) => {
@@ -114,17 +138,19 @@ StudentFeeHistoryModel.init({
114
138
  paymentType: { type: sequelize_1.DataTypes.STRING, allowNull: true },
115
139
  paidFee: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
116
140
  status: { type: sequelize_1.DataTypes.STRING, allowNull: true, defaultValue: constants_1.FEE_HISTORY_STATUS.COMPLETED },
117
- feeTypeId: { type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING), field: 'fee_type_id', allowNull: true, defaultValue: [] },
141
+ feeTypeId: { type: sequelize_1.DataTypes.UUID, field: 'fee_type_id', allowNull: true, defaultValue: null },
118
142
  bankAccountId: { type: sequelize_1.DataTypes.UUID, field: 'bank_account_id', allowNull: true },
119
143
  invoicePdf: { type: sequelize_1.DataTypes.UUID, field: 'invoice_pdf', allowNull: true },
120
144
  invoiceNumber: { type: sequelize_1.DataTypes.STRING, field: 'invoice_number', allowNull: true },
121
- feeHistoryConfigId: { type: sequelize_1.DataTypes.STRING, field: 'fee_history_config_id', allowNull: true },
145
+ feeHistoryConfigId: { type: sequelize_1.DataTypes.STRING, field: 'fee_history_config_id', allowNull: true }, // group id for one time pay all fee
122
146
  note: { type: sequelize_1.DataTypes.STRING, field: 'note', allowNull: true },
123
147
  studentFeeCollectionId: { type: sequelize_1.DataTypes.UUID, field: 'student_fee_collection_id', allowNull: true },
124
148
  paidDate: { type: sequelize_1.DataTypes.DATE, defaultValue: sequelize_1.DataTypes.NOW, allowNull: true },
125
149
  upiId: { type: sequelize_1.DataTypes.STRING, allowNull: true },
126
150
  bankName: { type: sequelize_1.DataTypes.STRING, allowNull: true },
127
151
  chequeNo: { type: sequelize_1.DataTypes.STRING, allowNull: true },
152
+ subjectId: { type: sequelize_1.DataTypes.UUID, field: 'subject_id', allowNull: true },
153
+ batchId: { type: sequelize_1.DataTypes.UUID, field: 'batch_id', allowNull: true },
128
154
  }, {
129
155
  modelName: 'StudentFeeHistoryModel',
130
156
  tableName: 'student_fee_history',
@@ -9,6 +9,8 @@ export declare class StudentFeeTypeCollectionModel extends Model<IStudentFeeType
9
9
  academicCalendarId: string;
10
10
  studentFeeCollectionId: string;
11
11
  feeTypeId: string;
12
+ batchId: string;
13
+ subjectId: string;
12
14
  amount: number;
13
15
  status: STUDENT_FEE_COLLECTION_STATUS;
14
16
  paidAmount: number;
@@ -6,7 +6,7 @@ const index_1 = require("./index");
6
6
  const constants_1 = require("../../constants");
7
7
  class StudentFeeTypeCollectionModel extends sequelize_1.Model {
8
8
  static associate(models) {
9
- const { UserModel, InstituteModel, StudentFeeCollectionModel, AcademicCalendarModel, FeeTypeModel } = models;
9
+ const { UserModel, InstituteModel, StudentFeeCollectionModel, AcademicCalendarModel, FeeTypeModel, InstituteEntityModel, BatchModel } = models;
10
10
  StudentFeeTypeCollectionModel.belongsTo(StudentFeeCollectionModel, {
11
11
  foreignKey: { name: 'studentFeeCollectionId', field: 'student_fee_collection_id', allowNull: true },
12
12
  as: 'feeTypeCollection',
@@ -47,6 +47,22 @@ class StudentFeeTypeCollectionModel extends sequelize_1.Model {
47
47
  foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
48
48
  as: 'acaCalFeeTypeCollection',
49
49
  });
50
+ StudentFeeTypeCollectionModel.belongsTo(InstituteEntityModel, {
51
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
52
+ as: 'feeTypeCollectionSubject',
53
+ });
54
+ InstituteEntityModel.hasMany(StudentFeeTypeCollectionModel, {
55
+ foreignKey: { name: 'subjectId', field: 'subject_id' },
56
+ as: 'subjectFeeTypeCollection',
57
+ });
58
+ StudentFeeTypeCollectionModel.belongsTo(BatchModel, {
59
+ foreignKey: { name: 'batchId', field: 'batch_id' },
60
+ as: 'feeTypeCollectionBatch',
61
+ });
62
+ BatchModel.hasMany(StudentFeeTypeCollectionModel, {
63
+ foreignKey: { name: 'batchId', field: 'batch_id' },
64
+ as: 'batchFeeTypeCollection',
65
+ });
50
66
  StudentFeeTypeCollectionModel.belongsTo(FeeTypeModel, {
51
67
  foreignKey: {
52
68
  name: 'feeTypeId',
@@ -87,6 +103,8 @@ StudentFeeTypeCollectionModel.init({
87
103
  paidAmount: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
88
104
  status: { type: sequelize_1.DataTypes.STRING, allowNull: true, defaultValue: constants_1.STUDENT_FEE_COLLECTION_STATUS.PENDING },
89
105
  feeTypeId: { type: sequelize_1.DataTypes.UUID, field: 'fee_type_id', allowNull: true },
106
+ subjectId: { type: sequelize_1.DataTypes.UUID, field: 'subject_id', allowNull: true },
107
+ batchId: { type: sequelize_1.DataTypes.UUID, field: 'batch_id', allowNull: true },
90
108
  }, {
91
109
  modelName: 'StudentFeeTypeCollectionModel',
92
110
  tableName: 'student_fee_type_collection',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.209",
3
+ "version": "1.1.211",
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",