@kipicore/dbcore 1.1.212 → 1.1.214

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): Promise<void>;
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const tableName = 'fee_type1';
4
+ const tableExists = await queryInterface
5
+ .describeTable(tableName)
6
+ .then(() => true)
7
+ .catch(() => false);
8
+ if (!tableExists) {
9
+ await queryInterface.createTable(tableName, {
10
+ id: {
11
+ type: Sequelize.UUID,
12
+ defaultValue: Sequelize.UUIDV4,
13
+ allowNull: false,
14
+ primaryKey: true,
15
+ },
16
+ typeManagementId: {
17
+ type: Sequelize.UUID,
18
+ allowNull: true,
19
+ field: 'type_management_id',
20
+ },
21
+ instituteId: {
22
+ type: Sequelize.UUID,
23
+ allowNull: true,
24
+ field: 'institute_id',
25
+ },
26
+ account: {
27
+ type: Sequelize.ARRAY(Sequelize.UUID),
28
+ allowNull: true,
29
+ defaultValue: [],
30
+ },
31
+ status: {
32
+ type: Sequelize.STRING,
33
+ allowNull: true,
34
+ },
35
+ module: {
36
+ type: Sequelize.STRING,
37
+ allowNull: true,
38
+ },
39
+ isDefault: {
40
+ type: Sequelize.STRING,
41
+ allowNull: true,
42
+ field: 'is_default',
43
+ },
44
+ isCreditAllowed: {
45
+ type: Sequelize.BOOLEAN,
46
+ allowNull: true,
47
+ field: 'is_credit_allowed',
48
+ defaultValue: false,
49
+ },
50
+ isRefundable: {
51
+ type: Sequelize.BOOLEAN,
52
+ allowNull: true,
53
+ field: 'is_refundable',
54
+ defaultValue: false,
55
+ },
56
+ isRequired: {
57
+ type: Sequelize.BOOLEAN,
58
+ allowNull: true,
59
+ field: 'is_required',
60
+ defaultValue: false,
61
+ },
62
+ isTaxable: {
63
+ type: Sequelize.BOOLEAN,
64
+ allowNull: true,
65
+ field: 'is_taxable',
66
+ defaultValue: false,
67
+ },
68
+ defaultAccount: {
69
+ type: Sequelize.UUID,
70
+ allowNull: true,
71
+ field: 'default_account',
72
+ },
73
+ feeType: {
74
+ type: Sequelize.STRING,
75
+ allowNull: true,
76
+ field: 'fee_type',
77
+ },
78
+ frequency: {
79
+ type: Sequelize.STRING,
80
+ allowNull: true,
81
+ },
82
+ academicCalendarId: {
83
+ type: Sequelize.UUID,
84
+ allowNull: true,
85
+ field: 'academic_calendar_id',
86
+ },
87
+ createdAt: {
88
+ type: Sequelize.DATE,
89
+ allowNull: false,
90
+ defaultValue: Sequelize.NOW,
91
+ field: 'created_at',
92
+ },
93
+ updatedAt: {
94
+ type: Sequelize.DATE,
95
+ allowNull: false,
96
+ defaultValue: Sequelize.NOW,
97
+ field: 'updated_at',
98
+ },
99
+ deletedAt: {
100
+ type: Sequelize.DATE,
101
+ allowNull: true,
102
+ field: 'deleted_at',
103
+ },
104
+ });
105
+ }
106
+ else {
107
+ const tableDefinition = await queryInterface.describeTable(tableName);
108
+ const columnsToAdd = {
109
+ typeManagementId: { type: Sequelize.UUID, allowNull: true, field: 'type_management_id' },
110
+ instituteId: { type: Sequelize.UUID, allowNull: true, field: 'institute_id' },
111
+ account: { type: Sequelize.ARRAY(Sequelize.UUID), allowNull: true, defaultValue: [] },
112
+ status: { type: Sequelize.STRING, allowNull: true },
113
+ module: { type: Sequelize.STRING, allowNull: true },
114
+ isDefault: { type: Sequelize.STRING, allowNull: true, field: 'is_default' },
115
+ isCreditAllowed: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_credit_allowed', defaultValue: false },
116
+ isRefundable: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_refundable', defaultValue: false },
117
+ isRequired: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_required', defaultValue: false },
118
+ isTaxable: { type: Sequelize.BOOLEAN, allowNull: true, field: 'is_taxable', defaultValue: false },
119
+ defaultAccount: { type: Sequelize.UUID, allowNull: true, field: 'default_account' },
120
+ feeType: { type: Sequelize.STRING, allowNull: true, field: 'fee_type' },
121
+ frequency: { type: Sequelize.STRING, allowNull: true },
122
+ academicCalendarId: { type: Sequelize.UUID, allowNull: true, field: 'academic_calendar_id' },
123
+ createdAt: { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW, field: 'created_at' },
124
+ updatedAt: { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW, field: 'updated_at' },
125
+ deletedAt: { type: Sequelize.DATE, allowNull: true, field: 'deleted_at' },
126
+ };
127
+ for (const key of Object.keys(columnsToAdd)) {
128
+ const column = columnsToAdd[key];
129
+ const columnName = column.field || key;
130
+ if (!tableDefinition[columnName]) {
131
+ await queryInterface.addColumn(tableName, columnName, column);
132
+ }
133
+ }
134
+ }
135
+ };
136
+ const down = async (queryInterface) => {
137
+ const tableName = 'fee_type1';
138
+ const tableExists = await queryInterface
139
+ .describeTable(tableName)
140
+ .then(() => true)
141
+ .catch(() => false);
142
+ if (tableExists) {
143
+ await queryInterface.dropTable(tableName);
144
+ }
145
+ };
146
+ module.exports = {
147
+ up,
148
+ down,
149
+ };
@@ -0,0 +1,19 @@
1
+ import { FEE_TYPE, COMMAN_STATUS, FEE_TYPE_FREQUENCY, BOOLEAN_STATUS } from '../constants/app';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ export interface IFeeType1ModelAttributes extends IDefaultAttributes {
4
+ id: string;
5
+ typeManagementId: string;
6
+ frequency: FEE_TYPE_FREQUENCY;
7
+ feeType: FEE_TYPE;
8
+ module: COMMAN_STATUS;
9
+ status: COMMAN_STATUS;
10
+ account: string[];
11
+ isCreditAllowed: boolean;
12
+ defaultAccount: string;
13
+ isRefundable: boolean;
14
+ isTaxable: boolean;
15
+ isRequired: boolean;
16
+ instituteId: string;
17
+ isDefault: BOOLEAN_STATUS;
18
+ academicCalendarId: string;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -43,6 +43,7 @@ export interface IInquiryModelAttributes extends IDefaultAttributes, Document {
43
43
  instituteId: string;
44
44
  basicInformation: IBasicInformation;
45
45
  academicInformation: IAcademicInformation;
46
+ academicCalendarId: string;
46
47
  guardianInformation: IGuardianInformation;
47
48
  address?: IAddressSchema;
48
49
  referredBy: INQUIRY_REFERRED_BY;
@@ -9,12 +9,12 @@ export interface IFeeStructure {
9
9
  terms: ITerms1Schema[];
10
10
  totalAmount: number;
11
11
  frequency: PAYMENT_TERMS_TYPE;
12
- isNotApplicableForGirls: boolean;
13
12
  title: string;
14
13
  referenceId: string;
15
14
  }
16
15
  export interface IFee1Schema {
17
16
  feeTypeId: string;
17
+ isNotApplicableForGirls: boolean;
18
18
  paymentMethod: PAYMENT_TYPE[];
19
19
  feeStructure: IFeeStructure[];
20
20
  }
@@ -124,6 +124,7 @@ const InquirySchema = new mongoose_1.Schema({
124
124
  guardianInformation: { type: GuardianInformationSchema, required: false, default: {} },
125
125
  lastSchoolInformation: { type: LastSchoolSchema, required: false, default: {} },
126
126
  address: { type: AddressSchema, required: false, default: {} },
127
+ academicCalendarId: { type: String, required: false },
127
128
  referredBy: {
128
129
  type: String,
129
130
  enum: Object.values(app_1.INQUIRY_REFERRED_BY),
@@ -83,10 +83,6 @@ const feeStructureSchema = new mongoose_1.Schema({
83
83
  required: false,
84
84
  default: crypto.randomUUID(),
85
85
  },
86
- isNotApplicableForGirls: {
87
- type: Boolean,
88
- default: false,
89
- },
90
86
  // isRefundable: {
91
87
  // type: Boolean,
92
88
  // default: false,
@@ -95,9 +91,6 @@ const feeStructureSchema = new mongoose_1.Schema({
95
91
  // type: Boolean,
96
92
  // default: false,
97
93
  // },
98
- // isRequired: {
99
- // type: Boolean,
100
- // },
101
94
  }, { _id: false });
102
95
  const feeSchema = new mongoose_1.Schema({
103
96
  feeTypeId: {
@@ -107,6 +100,13 @@ const feeSchema = new mongoose_1.Schema({
107
100
  // isCreditAllowed: {
108
101
  // type: Boolean,
109
102
  // },
103
+ isNotApplicableForGirls: {
104
+ type: Boolean,
105
+ default: false,
106
+ },
107
+ // isRequired: {
108
+ // type: Boolean,
109
+ // },
110
110
  paymentMethod: {
111
111
  type: [String],
112
112
  enum: Object.values(app_1.PAYMENT_TYPE),
@@ -0,0 +1,29 @@
1
+ import { Model } from 'sequelize';
2
+ import { IFeeType1ModelAttributes } from '../../interfaces/feeType1Interface';
3
+ import { TFeeType1ModelCreationAttributes } from '../../types/feeType1Type';
4
+ import { BOOLEAN_STATUS, COMMAN_STATUS, FEE_TYPE, FEE_TYPE_FREQUENCY } from '../../constants/app';
5
+ declare class FeeType1Model extends Model<IFeeType1ModelAttributes, TFeeType1ModelCreationAttributes> {
6
+ id: string;
7
+ instituteId: string;
8
+ typeManagementId: string;
9
+ frequency: FEE_TYPE_FREQUENCY;
10
+ feeType: FEE_TYPE;
11
+ module: COMMAN_STATUS;
12
+ status: COMMAN_STATUS;
13
+ account: string[];
14
+ isDefault: BOOLEAN_STATUS;
15
+ academicCalendarId: string;
16
+ isCreditAllowed: boolean;
17
+ defaultAccount: string;
18
+ isRefundable: boolean;
19
+ isTaxable: boolean;
20
+ isRequired: boolean;
21
+ createdBy: string;
22
+ updatedBy: string;
23
+ deletedBy: string;
24
+ readonly createdAt: Date;
25
+ readonly deletedAt: string;
26
+ readonly updatedAt: Date;
27
+ static associate(models: any): void;
28
+ }
29
+ export default FeeType1Model;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ const app_1 = require("../../constants/app");
6
+ class FeeType1Model extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { BankAccountDetailsModel, TypeManagementModel, InstituteModel, UserModel, AcademicCalendarModel } = models;
9
+ FeeType1Model.belongsTo(BankAccountDetailsModel, {
10
+ foreignKey: { name: 'defaultAccount' },
11
+ as: 'accountFeeType1',
12
+ });
13
+ BankAccountDetailsModel.hasMany(FeeType1Model, {
14
+ foreignKey: 'defaultAccount',
15
+ as: 'feeType1HasAccount',
16
+ });
17
+ TypeManagementModel.hasMany(FeeType1Model, {
18
+ foreignKey: 'typeManagementId',
19
+ as: 'feeType1TypeManagement',
20
+ });
21
+ FeeType1Model.belongsTo(TypeManagementModel, {
22
+ foreignKey: { name: 'typeManagementId' },
23
+ as: 'typeManagementFeeType',
24
+ });
25
+ FeeType1Model.belongsTo(InstituteModel, {
26
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
27
+ as: 'instituteFeeType1',
28
+ });
29
+ InstituteModel.hasMany(FeeType1Model, {
30
+ foreignKey: 'instituteId',
31
+ as: 'feeType1Institute',
32
+ });
33
+ FeeType1Model.belongsTo(UserModel, {
34
+ foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
35
+ as: 'createdByUser',
36
+ });
37
+ FeeType1Model.belongsTo(UserModel, {
38
+ foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
39
+ as: 'updatedByUser',
40
+ });
41
+ FeeType1Model.belongsTo(UserModel, {
42
+ foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
43
+ as: 'deletedByUser',
44
+ });
45
+ FeeType1Model.belongsTo(AcademicCalendarModel, {
46
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
47
+ as: 'feeType1AcademicCalendar',
48
+ });
49
+ AcademicCalendarModel.hasMany(FeeType1Model, {
50
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
51
+ as: 'academicCalendarFeeType1',
52
+ });
53
+ }
54
+ }
55
+ FeeType1Model.init({
56
+ id: {
57
+ type: sequelize_1.DataTypes.UUID,
58
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
59
+ allowNull: false,
60
+ primaryKey: true,
61
+ },
62
+ typeManagementId: {
63
+ type: sequelize_1.DataTypes.UUID,
64
+ field: 'type_management_id',
65
+ allowNull: true,
66
+ },
67
+ instituteId: {
68
+ type: sequelize_1.DataTypes.UUID,
69
+ field: 'institute_id',
70
+ allowNull: true,
71
+ },
72
+ account: {
73
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.UUID),
74
+ defaultValue: [],
75
+ allowNull: true,
76
+ },
77
+ status: {
78
+ type: sequelize_1.DataTypes.STRING,
79
+ defaultValue: app_1.COMMAN_STATUS.ACTIVE,
80
+ allowNull: true,
81
+ },
82
+ module: {
83
+ type: sequelize_1.DataTypes.STRING,
84
+ defaultValue: app_1.COMMAN_STATUS.INACTIVE,
85
+ allowNull: true,
86
+ },
87
+ isDefault: {
88
+ type: sequelize_1.DataTypes.STRING,
89
+ allowNull: true,
90
+ field: 'is_default',
91
+ defaultValue: app_1.BOOLEAN_STATUS.NO,
92
+ },
93
+ isCreditAllowed: {
94
+ type: sequelize_1.DataTypes.BOOLEAN,
95
+ allowNull: true,
96
+ field: 'is_credit_allowed',
97
+ defaultValue: false,
98
+ },
99
+ isRefundable: {
100
+ type: sequelize_1.DataTypes.BOOLEAN,
101
+ allowNull: true,
102
+ field: 'is_refundable',
103
+ defaultValue: false,
104
+ },
105
+ isRequired: {
106
+ type: sequelize_1.DataTypes.BOOLEAN,
107
+ allowNull: true,
108
+ field: 'is_required',
109
+ defaultValue: false,
110
+ },
111
+ isTaxable: {
112
+ type: sequelize_1.DataTypes.BOOLEAN,
113
+ allowNull: true,
114
+ field: 'is_taxable',
115
+ defaultValue: false,
116
+ },
117
+ defaultAccount: {
118
+ type: sequelize_1.DataTypes.UUID,
119
+ field: 'default_account',
120
+ allowNull: true,
121
+ },
122
+ feeType: {
123
+ type: sequelize_1.DataTypes.STRING,
124
+ field: 'fee_type',
125
+ allowNull: true,
126
+ },
127
+ frequency: {
128
+ type: sequelize_1.DataTypes.STRING,
129
+ allowNull: true,
130
+ },
131
+ academicCalendarId: {
132
+ type: sequelize_1.DataTypes.UUID,
133
+ field: 'academic_calendar_id',
134
+ allowNull: true,
135
+ },
136
+ }, {
137
+ modelName: 'FeeType1Model',
138
+ tableName: 'fee_type1',
139
+ timestamps: true,
140
+ sequelize: index_1.sequelize,
141
+ });
142
+ exports.default = FeeType1Model;
@@ -0,0 +1,3 @@
1
+ import { Optional } from 'sequelize';
2
+ import { IFeeType1ModelAttributes } from '../interfaces/feeType1Interface';
3
+ export type TFeeType1ModelCreationAttributes = Optional<IFeeType1ModelAttributes, 'id'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.212",
3
+ "version": "1.1.214",
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",