@kipicore/dbcore 1.1.192 → 1.1.193

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.
@@ -8,6 +8,7 @@ export interface IFeeTypeModelAttributes extends IDefaultAttributes {
8
8
  module: COMMAN_STATUS;
9
9
  status: COMMAN_STATUS;
10
10
  account: string;
11
+ academicCalendarId?: string;
11
12
  instituteId: string;
12
13
  isDefault: BOOLEAN_STATUS;
13
14
  }
@@ -12,11 +12,13 @@ declare class FeeTypeModel extends Model<IFeeTypeModelAttributes, TFeeTypeModelC
12
12
  status: COMMAN_STATUS;
13
13
  account: string;
14
14
  isDefault: BOOLEAN_STATUS;
15
+ academicCalendarId: string;
15
16
  createdBy: string;
16
17
  updatedBy: string;
17
18
  deletedBy: string;
18
19
  readonly createdAt: Date;
19
20
  readonly deletedAt: string;
20
21
  readonly updatedAt: Date;
22
+ static associate(models: any): void;
21
23
  }
22
24
  export default FeeTypeModel;
@@ -1,165 +1,56 @@
1
1
  "use strict";
2
- // import { DataTypes, Model } from 'sequelize';
3
- // import { sequelize } from './index';
4
- // import { IFeeTypeModelAttributes } from '../../interfaces/feeTypeInterface';
5
- // import { TFeeTypeModelCreationAttributes } from '../../types/feeTypeType';
6
- // import { BOOLEAN_STATUS, COMMAN_STATUS, FEE_TYPE, FEE_TYPE_FREQUENCY } from '../../constants/app';
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
- // class FeeTypeModel extends Model<IFeeTypeModelAttributes, TFeeTypeModelCreationAttributes> {
12
- // declare id: string;
13
- // declare instituteId: string;
14
- // declare typeManagementId: string;
15
- // declare frequency: FEE_TYPE_FREQUENCY;
16
- // declare feeType: FEE_TYPE;
17
- // declare module: COMMAN_STATUS;
18
- // declare status: COMMAN_STATUS;
19
- // declare account: string[];
20
- // declare isCreditAllowed: boolean;
21
- // declare isCashAllowed: boolean;
22
- // declare isRefundable: boolean;
23
- // declare isTaxable: boolean;
24
- // declare isRequired: boolean;
25
- // declare isDefault: BOOLEAN_STATUS;
26
- // declare academicCalendarId: string;
27
- // declare createdBy: string;
28
- // declare updatedBy: string;
29
- // declare deletedBy: string;
30
- // declare readonly createdAt: Date;
31
- // declare readonly deletedAt: string;
32
- // declare readonly updatedAt: Date;
33
- // static associate(models: any) {
34
- // const { TypeManagementModel, InstituteModel, UserModel, AcademicCalendarModel } = models;
35
- // // FeeTypeModel.belongsTo(BankAccountDetailsModel, {
36
- // // foreignKey: { name: 'account' },
37
- // // as: 'accountFeeType',
38
- // // });
39
- // // BankAccountDetailsModel.hasMany(FeeTypeModel, {
40
- // // foreignKey: 'account',
41
- // // as: 'feeTypeHasAccount',
42
- // // });
43
- // TypeManagementModel.hasMany(FeeTypeModel, {
44
- // foreignKey: 'typeManagementId',
45
- // as: 'feeTypeTypeManagement',
46
- // });
47
- // FeeTypeModel.belongsTo(TypeManagementModel, {
48
- // foreignKey: { name: 'typeManagementId' },
49
- // as: 'typeManagementType',
50
- // });
51
- // FeeTypeModel.belongsTo(InstituteModel, {
52
- // foreignKey: { name: 'instituteId', field: 'institute_id' },
53
- // as: 'instituteFeeType',
54
- // });
55
- // InstituteModel.hasMany(FeeTypeModel, {
56
- // foreignKey: 'instituteId',
57
- // as: 'feeTypeInstitute',
58
- // });
59
- // FeeTypeModel.belongsTo(UserModel, {
60
- // foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
61
- // as: 'createdByUser',
62
- // });
63
- // FeeTypeModel.belongsTo(UserModel, {
64
- // foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
65
- // as: 'updatedByUser',
66
- // });
67
- // FeeTypeModel.belongsTo(UserModel, {
68
- // foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
69
- // as: 'deletedByUser',
70
- // });
71
- // FeeTypeModel.belongsTo(AcademicCalendarModel, {
72
- // foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
73
- // as: 'feeTypeAcademicCalendar',
74
- // });
75
- // AcademicCalendarModel.hasMany(FeeTypeModel, {
76
- // foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
77
- // as: 'academicCalendarFeeType',
78
- // });
79
- // }
80
- // }
81
- // FeeTypeModel.init(
82
- // {
83
- // id: {
84
- // type: DataTypes.UUID,
85
- // defaultValue: DataTypes.UUIDV4,
86
- // allowNull: false,
87
- // primaryKey: true,
88
- // },
89
- // typeManagementId: {
90
- // type: DataTypes.UUID,
91
- // field: 'type_management_id',
92
- // allowNull: false,
93
- // },
94
- // instituteId: {
95
- // type: DataTypes.UUID,
96
- // field: 'institute_id',
97
- // allowNull: false,
98
- // },
99
- // account: {
100
- // type: DataTypes.ARRAY(DataTypes.UUID),
101
- // allowNull: true,
102
- // },
103
- // status: {
104
- // type: DataTypes.ENUM(...Object.values(COMMAN_STATUS)),
105
- // defaultValue: COMMAN_STATUS.ACTIVE,
106
- // allowNull: false,
107
- // },
108
- // module: {
109
- // type: DataTypes.ENUM(...Object.values(COMMAN_STATUS)),
110
- // defaultValue: COMMAN_STATUS.INACTIVE,
111
- // allowNull: false,
112
- // },
113
- // isDefault: {
114
- // type: DataTypes.ENUM(...Object.values(BOOLEAN_STATUS)),
115
- // allowNull: false,
116
- // defaultValue: BOOLEAN_STATUS.NO,
117
- // },
118
- // feeType: {
119
- // type: DataTypes.ENUM(...Object.values(FEE_TYPE)),
120
- // allowNull: false,
121
- // },
122
- // frequency: {
123
- // type: DataTypes.ENUM(...Object.values(FEE_TYPE_FREQUENCY)),
124
- // allowNull: false,
125
- // },
126
- // academicCalendarId: {
127
- // type: DataTypes.UUID,
128
- // field: 'academic_calendar_id',
129
- // allowNull: true,
130
- // },
131
- // isCreditAllowed: {
132
- // type: DataTypes.BOOLEAN,
133
- // },
134
- // isCashAllowed: {
135
- // type: DataTypes.BOOLEAN,
136
- // },
137
- // isRefundable: {
138
- // type: DataTypes.BOOLEAN,
139
- // },
140
- // isTaxable: {
141
- // type: DataTypes.BOOLEAN,
142
- // },
143
- // isRequired: {
144
- // type: DataTypes.BOOLEAN,
145
- // },
146
- // },
147
- // {
148
- // modelName: 'FeeTypeModel',
149
- // tableName: 'fee_type',
150
- // timestamps: true,
151
- // sequelize,
152
- // },
153
- // );
154
- // export default FeeTypeModel;
155
3
  const sequelize_1 = require("sequelize");
156
4
  const index_1 = require("./index");
157
5
  const app_1 = require("../../constants/app");
158
- const instituteModel_1 = __importDefault(require("./instituteModel"));
159
- const userModel_1 = __importDefault(require("./userModel"));
160
- const bankAccountDetailsModel_1 = __importDefault(require("./bankAccountDetailsModel"));
161
- const typeManagementModel_1 = __importDefault(require("./typeManagementModel"));
162
6
  class FeeTypeModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { BankAccountDetailsModel, TypeManagementModel, InstituteModel, UserModel, AcademicCalendarModel } = models;
9
+ FeeTypeModel.belongsTo(BankAccountDetailsModel, {
10
+ foreignKey: { name: 'account' },
11
+ as: 'accountFeeType',
12
+ });
13
+ BankAccountDetailsModel.hasMany(FeeTypeModel, {
14
+ foreignKey: 'account',
15
+ as: 'feeTypeHasAccount',
16
+ });
17
+ TypeManagementModel.hasMany(FeeTypeModel, {
18
+ foreignKey: 'typeManagementId',
19
+ as: 'feeTypeTypeManagement',
20
+ });
21
+ FeeTypeModel.belongsTo(TypeManagementModel, {
22
+ foreignKey: { name: 'typeManagementId' },
23
+ as: 'typeManagementType',
24
+ });
25
+ FeeTypeModel.belongsTo(InstituteModel, {
26
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
27
+ as: 'instituteFeeType',
28
+ });
29
+ InstituteModel.hasMany(FeeTypeModel, {
30
+ foreignKey: 'instituteId',
31
+ as: 'feeTypeInstitute',
32
+ });
33
+ FeeTypeModel.belongsTo(UserModel, {
34
+ foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
35
+ as: 'createdByUser',
36
+ });
37
+ FeeTypeModel.belongsTo(UserModel, {
38
+ foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
39
+ as: 'updatedByUser',
40
+ });
41
+ FeeTypeModel.belongsTo(UserModel, {
42
+ foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
43
+ as: 'deletedByUser',
44
+ });
45
+ FeeTypeModel.belongsTo(AcademicCalendarModel, {
46
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
47
+ as: 'feeTypeAcademicCalendar',
48
+ });
49
+ AcademicCalendarModel.hasMany(FeeTypeModel, {
50
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
51
+ as: 'academicCalendarFeeType',
52
+ });
53
+ }
163
54
  }
164
55
  FeeTypeModel.init({
165
56
  id: {
@@ -183,92 +74,37 @@ FeeTypeModel.init({
183
74
  allowNull: false,
184
75
  },
185
76
  status: {
186
- type: sequelize_1.DataTypes.ENUM,
187
- values: Object.values(app_1.COMMAN_STATUS),
77
+ type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.COMMAN_STATUS)),
188
78
  defaultValue: app_1.COMMAN_STATUS.ACTIVE,
189
79
  allowNull: false,
190
80
  },
191
81
  module: {
192
- type: sequelize_1.DataTypes.ENUM,
193
- values: Object.values(app_1.COMMAN_STATUS),
82
+ type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.COMMAN_STATUS)),
194
83
  defaultValue: app_1.COMMAN_STATUS.INACTIVE,
195
84
  allowNull: false,
196
85
  },
197
86
  isDefault: {
198
- type: sequelize_1.DataTypes.ENUM,
199
- values: Object.values(app_1.BOOLEAN_STATUS),
87
+ type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.BOOLEAN_STATUS)),
200
88
  allowNull: false,
201
89
  defaultValue: app_1.BOOLEAN_STATUS.NO,
202
90
  },
203
91
  feeType: {
204
- type: sequelize_1.DataTypes.ENUM,
205
- values: Object.values(app_1.FEE_TYPE),
92
+ type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.FEE_TYPE)),
206
93
  allowNull: false,
207
94
  },
208
95
  frequency: {
209
- type: sequelize_1.DataTypes.ENUM,
210
- values: Object.values(app_1.FEE_TYPE_FREQUENCY),
96
+ type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.FEE_TYPE_FREQUENCY)),
211
97
  allowNull: false,
212
98
  },
99
+ academicCalendarId: {
100
+ type: sequelize_1.DataTypes.UUID,
101
+ field: 'academic_calendar_id',
102
+ allowNull: true,
103
+ },
213
104
  }, {
214
105
  modelName: 'FeeTypeModel',
215
106
  tableName: 'fee_type',
216
107
  timestamps: true,
217
108
  sequelize: index_1.sequelize,
218
109
  });
219
- FeeTypeModel.belongsTo(bankAccountDetailsModel_1.default, {
220
- foreignKey: {
221
- name: 'account',
222
- },
223
- as: 'accountFeeType',
224
- });
225
- bankAccountDetailsModel_1.default.hasMany(FeeTypeModel, {
226
- foreignKey: 'account',
227
- as: 'feeTypeHasAccount',
228
- });
229
- typeManagementModel_1.default.hasMany(FeeTypeModel, {
230
- foreignKey: 'typeManagementId',
231
- as: 'feeTypeTypeManagement',
232
- });
233
- FeeTypeModel.belongsTo(typeManagementModel_1.default, {
234
- foreignKey: {
235
- name: 'typeManagementId',
236
- },
237
- as: 'typeManagementType',
238
- });
239
- FeeTypeModel.belongsTo(instituteModel_1.default, {
240
- foreignKey: {
241
- name: 'instituteId',
242
- field: 'institute_id',
243
- },
244
- as: 'instituteFeeType',
245
- });
246
- instituteModel_1.default.hasMany(FeeTypeModel, {
247
- foreignKey: 'instituteId',
248
- as: 'feeTypeInstitute',
249
- });
250
- FeeTypeModel.belongsTo(userModel_1.default, {
251
- foreignKey: {
252
- name: 'createdBy',
253
- allowNull: true,
254
- field: 'created_by',
255
- },
256
- as: 'createdByUser',
257
- });
258
- FeeTypeModel.belongsTo(userModel_1.default, {
259
- foreignKey: {
260
- name: 'updatedBy',
261
- allowNull: true,
262
- field: 'updated_by',
263
- },
264
- as: 'updatedByUser',
265
- });
266
- FeeTypeModel.belongsTo(userModel_1.default, {
267
- foreignKey: {
268
- name: 'deletedBy',
269
- allowNull: true,
270
- field: 'deleted_by',
271
- },
272
- as: 'deletedByUser',
273
- });
274
110
  exports.default = FeeTypeModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.192",
3
+ "version": "1.1.193",
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",