@kipicore/dbcore 1.1.191 → 1.1.192

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.
@@ -1,5 +1,5 @@
1
- import { IDefaultAttributes } from './commonInterface';
2
1
  import { FEE_TYPE, COMMAN_STATUS, FEE_TYPE_FREQUENCY, BOOLEAN_STATUS } from '../constants/app';
2
+ import { IDefaultAttributes } from './commonInterface';
3
3
  export interface IFeeTypeModelAttributes extends IDefaultAttributes {
4
4
  id: string;
5
5
  typeManagementId: string;
@@ -7,13 +7,7 @@ export interface IFeeTypeModelAttributes extends IDefaultAttributes {
7
7
  feeType: FEE_TYPE;
8
8
  module: COMMAN_STATUS;
9
9
  status: COMMAN_STATUS;
10
- account: string[];
11
- isCreditAllowed: boolean;
12
- isCashAllowed: boolean;
13
- isRefundable: boolean;
14
- isTaxable: boolean;
15
- isRequired: boolean;
10
+ account: string;
16
11
  instituteId: string;
17
12
  isDefault: BOOLEAN_STATUS;
18
- academicCalendarId: string;
19
13
  }
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ // import { IDefaultAttributes } from './commonInterface';
3
+ // import { FEE_TYPE, COMMAN_STATUS, FEE_TYPE_FREQUENCY, BOOLEAN_STATUS } from '../constants/app';
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,20 +10,13 @@ declare class FeeTypeModel extends Model<IFeeTypeModelAttributes, TFeeTypeModelC
10
10
  feeType: FEE_TYPE;
11
11
  module: COMMAN_STATUS;
12
12
  status: COMMAN_STATUS;
13
- account: string[];
14
- isCreditAllowed: boolean;
15
- isCashAllowed: boolean;
16
- isRefundable: boolean;
17
- isTaxable: boolean;
18
- isRequired: boolean;
13
+ account: string;
19
14
  isDefault: BOOLEAN_STATUS;
20
- academicCalendarId: string;
21
15
  createdBy: string;
22
16
  updatedBy: string;
23
17
  deletedBy: string;
24
18
  readonly createdAt: Date;
25
19
  readonly deletedAt: string;
26
20
  readonly updatedAt: Date;
27
- static associate(models: any): void;
28
21
  }
29
22
  export default FeeTypeModel;
@@ -1,56 +1,165 @@
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
+ };
2
10
  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;
3
155
  const sequelize_1 = require("sequelize");
4
156
  const index_1 = require("./index");
5
157
  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"));
6
162
  class FeeTypeModel extends sequelize_1.Model {
7
- static associate(models) {
8
- const { 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
- }
54
163
  }
55
164
  FeeTypeModel.init({
56
165
  id: {
@@ -70,56 +179,96 @@ FeeTypeModel.init({
70
179
  allowNull: false,
71
180
  },
72
181
  account: {
73
- type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.UUID),
74
- allowNull: true,
182
+ type: sequelize_1.DataTypes.UUID,
183
+ allowNull: false,
75
184
  },
76
185
  status: {
77
- type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.COMMAN_STATUS)),
186
+ type: sequelize_1.DataTypes.ENUM,
187
+ values: Object.values(app_1.COMMAN_STATUS),
78
188
  defaultValue: app_1.COMMAN_STATUS.ACTIVE,
79
189
  allowNull: false,
80
190
  },
81
191
  module: {
82
- type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.COMMAN_STATUS)),
192
+ type: sequelize_1.DataTypes.ENUM,
193
+ values: Object.values(app_1.COMMAN_STATUS),
83
194
  defaultValue: app_1.COMMAN_STATUS.INACTIVE,
84
195
  allowNull: false,
85
196
  },
86
197
  isDefault: {
87
- type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.BOOLEAN_STATUS)),
198
+ type: sequelize_1.DataTypes.ENUM,
199
+ values: Object.values(app_1.BOOLEAN_STATUS),
88
200
  allowNull: false,
89
201
  defaultValue: app_1.BOOLEAN_STATUS.NO,
90
202
  },
91
203
  feeType: {
92
- type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.FEE_TYPE)),
204
+ type: sequelize_1.DataTypes.ENUM,
205
+ values: Object.values(app_1.FEE_TYPE),
93
206
  allowNull: false,
94
207
  },
95
208
  frequency: {
96
- type: sequelize_1.DataTypes.ENUM(...Object.values(app_1.FEE_TYPE_FREQUENCY)),
209
+ type: sequelize_1.DataTypes.ENUM,
210
+ values: Object.values(app_1.FEE_TYPE_FREQUENCY),
97
211
  allowNull: false,
98
212
  },
99
- academicCalendarId: {
100
- type: sequelize_1.DataTypes.UUID,
101
- field: 'academic_calendar_id',
102
- allowNull: true,
213
+ }, {
214
+ modelName: 'FeeTypeModel',
215
+ tableName: 'fee_type',
216
+ timestamps: true,
217
+ sequelize: index_1.sequelize,
218
+ });
219
+ FeeTypeModel.belongsTo(bankAccountDetailsModel_1.default, {
220
+ foreignKey: {
221
+ name: 'account',
103
222
  },
104
- isCreditAllowed: {
105
- type: sequelize_1.DataTypes.BOOLEAN,
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',
106
236
  },
107
- isCashAllowed: {
108
- type: sequelize_1.DataTypes.BOOLEAN,
237
+ as: 'typeManagementType',
238
+ });
239
+ FeeTypeModel.belongsTo(instituteModel_1.default, {
240
+ foreignKey: {
241
+ name: 'instituteId',
242
+ field: 'institute_id',
109
243
  },
110
- isRefundable: {
111
- type: sequelize_1.DataTypes.BOOLEAN,
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',
112
255
  },
113
- isTaxable: {
114
- type: sequelize_1.DataTypes.BOOLEAN,
256
+ as: 'createdByUser',
257
+ });
258
+ FeeTypeModel.belongsTo(userModel_1.default, {
259
+ foreignKey: {
260
+ name: 'updatedBy',
261
+ allowNull: true,
262
+ field: 'updated_by',
115
263
  },
116
- isRequired: {
117
- type: sequelize_1.DataTypes.BOOLEAN,
264
+ as: 'updatedByUser',
265
+ });
266
+ FeeTypeModel.belongsTo(userModel_1.default, {
267
+ foreignKey: {
268
+ name: 'deletedBy',
269
+ allowNull: true,
270
+ field: 'deleted_by',
118
271
  },
119
- }, {
120
- modelName: 'FeeTypeModel',
121
- tableName: 'fee_type',
122
- timestamps: true,
123
- sequelize: index_1.sequelize,
272
+ as: 'deletedByUser',
124
273
  });
125
274
  exports.default = FeeTypeModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.191",
3
+ "version": "1.1.192",
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",