@kipicore/dbcore 1.1.204 → 1.1.206

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.
@@ -1088,7 +1088,8 @@ export declare enum WORK_OFF_DAYS_ERROR_MESSAGES {
1088
1088
  GET_FAIL = "Unable to retrieve Work Off Days Data!",
1089
1089
  UPDATE_FAIL = "Unable to update Work Off Days Data!",
1090
1090
  DELETE_FAIL = "Unable to delete Work Off Days Data!",
1091
- NOT_FOUND = "Unable to find Work Off Days Data!"
1091
+ NOT_FOUND = "Unable to find Work Off Days Data!",
1092
+ DUPLICATE = "Work Off already exist!"
1092
1093
  }
1093
1094
  export declare enum ADVERTISEMENT_ERROR_MESSAGES {
1094
1095
  CREATE_FAIL = "Unable to save advertisement data!",
@@ -1205,6 +1205,7 @@ var WORK_OFF_DAYS_ERROR_MESSAGES;
1205
1205
  WORK_OFF_DAYS_ERROR_MESSAGES["UPDATE_FAIL"] = "Unable to update Work Off Days Data!";
1206
1206
  WORK_OFF_DAYS_ERROR_MESSAGES["DELETE_FAIL"] = "Unable to delete Work Off Days Data!";
1207
1207
  WORK_OFF_DAYS_ERROR_MESSAGES["NOT_FOUND"] = "Unable to find Work Off Days Data!";
1208
+ WORK_OFF_DAYS_ERROR_MESSAGES["DUPLICATE"] = "Work Off already exist!";
1208
1209
  })(WORK_OFF_DAYS_ERROR_MESSAGES || (exports.WORK_OFF_DAYS_ERROR_MESSAGES = WORK_OFF_DAYS_ERROR_MESSAGES = {}));
1209
1210
  var ADVERTISEMENT_ERROR_MESSAGES;
1210
1211
  (function (ADVERTISEMENT_ERROR_MESSAGES) {
@@ -5,5 +5,6 @@ export interface ISubjectHasPayFeeHistoryModelAttributes extends IDefaultAttribu
5
5
  userId: string;
6
6
  subjectId: string;
7
7
  feeCollectionId: string;
8
+ academicCalendarId?: string;
8
9
  amount: number;
9
10
  }
@@ -91,11 +91,12 @@ class FeeHistoryModel extends sequelize_1.Model {
91
91
  }
92
92
  static addHooks(models) {
93
93
  const { FileStorageModel, FeesCollectionModel, InstituteEntityModel, UserHasSubjectFeeModel, SubjectHasPayFeeHistory } = models;
94
- const subjectWiserFeePay = async (instituteId, feeCollectionId, paidFee, userId) => {
94
+ const subjectWiserFeePay = async (instituteId, feeCollectionId, paidFee, userId, academicCalendarId) => {
95
95
  const { InstituteEntityModel, UserHasSubjectFeeModel, FeesCollectionModel, SubjectHasPayFeeHistory } = models;
96
96
  const userInstituteMeta = await userInstituteMetaModel_1.default.findOne({
97
97
  userId,
98
98
  instituteId,
99
+ academicCalendarId,
99
100
  status: app_1.USER_INSTITUTE_META_STATUS.ACCEPTED,
100
101
  });
101
102
  if (!userInstituteMeta)
@@ -106,7 +107,7 @@ class FeeHistoryModel extends sequelize_1.Model {
106
107
  });
107
108
  const subjectIds = subjects.map((subject) => subject.id);
108
109
  const fees = await UserHasSubjectFeeModel.findAll({
109
- where: { subjectId: { [sequelize_1.Op.in]: subjectIds }, instituteId },
110
+ where: { subjectId: { [sequelize_1.Op.in]: subjectIds }, instituteId, academicCalendarId },
110
111
  });
111
112
  const feeCollection = await FeesCollectionModel.findByPk(feeCollectionId);
112
113
  if (!feeCollection)
@@ -120,6 +121,7 @@ class FeeHistoryModel extends sequelize_1.Model {
120
121
  userId,
121
122
  subjectId: distribution.subjectId,
122
123
  feeCollectionId,
124
+ academicCalendarId,
123
125
  amount: distribution.amount,
124
126
  })));
125
127
  };
@@ -153,7 +155,7 @@ class FeeHistoryModel extends sequelize_1.Model {
153
155
  }
154
156
  }
155
157
  if ((!feeCollection.feeTypeId || feeCollection.feeTypeId.length === 0) && !feeCollection.bankAccountId) {
156
- await subjectWiserFeePay(feeCollection.instituteId, feeCollection.feeCollectionId, feeCollection.paidFee, feeCollection.userId);
158
+ await subjectWiserFeePay(feeCollection.instituteId, feeCollection.feeCollectionId, feeCollection.paidFee, feeCollection.userId, feeCollection.academicCalendarId);
157
159
  }
158
160
  });
159
161
  }
@@ -8,6 +8,7 @@ declare class SubjectHasPayFeeHistory extends Model<ISubjectHasPayFeeHistoryMode
8
8
  subjectId: string;
9
9
  feeCollectionId: string;
10
10
  amount: number;
11
+ academicCalendarId: string;
11
12
  createdBy: string;
12
13
  updatedBy: string;
13
14
  deletedBy: string;
@@ -101,6 +101,11 @@ SubjectHasPayFeeHistory.init({
101
101
  type: sequelize_1.DataTypes.UUID,
102
102
  allowNull: false,
103
103
  },
104
+ academicCalendarId: {
105
+ type: sequelize_1.DataTypes.UUID,
106
+ field: 'academic_calendar_id',
107
+ allowNull: true,
108
+ },
104
109
  amount: {
105
110
  type: sequelize_1.DataTypes.FLOAT,
106
111
  allowNull: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.204",
3
+ "version": "1.1.206",
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",