@kipicore/dbcore 1.1.131 → 1.1.133

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.
Files changed (93) hide show
  1. package/dist/constants/app.d.ts +2 -1
  2. package/dist/constants/app.js +1 -0
  3. package/dist/constants/errorMessages.d.ts +2 -1
  4. package/dist/constants/errorMessages.js +1 -0
  5. package/dist/db/psql/migrations/20251125045339-income_expense_model.js +4 -4
  6. package/dist/db/psql/migrations/20251209061902-add-acl_id_feeTypeModel.d.ts +2 -0
  7. package/dist/db/psql/migrations/20251209061902-add-acl_id_feeTypeModel.js +21 -0
  8. package/dist/db/psql/migrations/20251210100917-id_add_typemanagement.d.ts +2 -0
  9. package/dist/db/psql/migrations/20251210100917-id_add_typemanagement.js +33 -0
  10. package/dist/db/psql/migrations/20251210101254-id_add_bankAccDetails.d.ts +2 -0
  11. package/dist/db/psql/migrations/20251210101254-id_add_bankAccDetails.js +22 -0
  12. package/dist/db/psql/migrations/20251210102112-id_add_accHasReceiptDetails.d.ts +2 -0
  13. package/dist/db/psql/migrations/20251210102112-id_add_accHasReceiptDetails.js +33 -0
  14. package/dist/db/psql/migrations/20251210102601-id_add_masterLeave.d.ts +2 -0
  15. package/dist/db/psql/migrations/20251210102601-id_add_masterLeave.js +22 -0
  16. package/dist/db/psql/migrations/20251210103020-id_add_slot.d.ts +2 -0
  17. package/dist/db/psql/migrations/20251210103020-id_add_slot.js +22 -0
  18. package/dist/db/psql/migrations/20251210103724-id_add_classRoom.d.ts +2 -0
  19. package/dist/db/psql/migrations/20251210103724-id_add_classRoom.js +22 -0
  20. package/dist/db/psql/migrations/20251210104353-id_add_floorManagement.d.ts +2 -0
  21. package/dist/db/psql/migrations/20251210104353-id_add_floorManagement.js +33 -0
  22. package/dist/db/psql/migrations/20251210105807-id_add_batch.d.ts +2 -0
  23. package/dist/db/psql/migrations/20251210105807-id_add_batch.js +22 -0
  24. package/dist/db/psql/migrations/20251210110340-id_add_workingshift.d.ts +2 -0
  25. package/dist/db/psql/migrations/20251210110340-id_add_workingshift.js +22 -0
  26. package/dist/db/psql/migrations/20251210110912-id_add_greetings.d.ts +2 -0
  27. package/dist/db/psql/migrations/20251210110912-id_add_greetings.js +22 -0
  28. package/dist/db/psql/migrations/20251210113530-id_add_role.d.ts +2 -0
  29. package/dist/db/psql/migrations/20251210113530-id_add_role.js +33 -0
  30. package/dist/db/psql/migrations/20251210122210-id_add_userHasRole.d.ts +2 -0
  31. package/dist/db/psql/migrations/20251210122210-id_add_userHasRole.js +33 -0
  32. package/dist/db/psql/migrations/20251210124921-id_add_subjectHFee.d.ts +2 -0
  33. package/dist/db/psql/migrations/20251210124921-id_add_subjectHFee.js +22 -0
  34. package/dist/db/psql/migrations/20251210130015-id_add_workingDay.d.ts +2 -0
  35. package/dist/db/psql/migrations/20251210130015-id_add_workingDay.js +22 -0
  36. package/dist/db/psql/migrations/20251210132959-id_add_reminderSetting.d.ts +2 -0
  37. package/dist/db/psql/migrations/20251210132959-id_add_reminderSetting.js +22 -0
  38. package/dist/interfaces/accountHasReceiptDetailsInterface.d.ts +2 -0
  39. package/dist/interfaces/bankAccountDetailsInterface.d.ts +1 -0
  40. package/dist/interfaces/batchInterface.d.ts +1 -0
  41. package/dist/interfaces/classRoomInterface.d.ts +1 -0
  42. package/dist/interfaces/feeReminderSettingInterface.d.ts +1 -0
  43. package/dist/interfaces/feeReminderTypeInterface.d.ts +1 -0
  44. package/dist/interfaces/floorManagementInterface.d.ts +2 -0
  45. package/dist/interfaces/greetingsInterface.d.ts +1 -0
  46. package/dist/interfaces/incomeExpenseInterface.d.ts +1 -1
  47. package/dist/interfaces/masterLeaveInterface.d.ts +1 -0
  48. package/dist/interfaces/roleInterface.d.ts +2 -0
  49. package/dist/interfaces/slotInterface.d.ts +1 -0
  50. package/dist/interfaces/subjectHasFeeInterface.d.ts +1 -0
  51. package/dist/interfaces/subjectIndexInterface.d.ts +2 -0
  52. package/dist/interfaces/typeManagementInterface.d.ts +2 -0
  53. package/dist/interfaces/userHasRoleInterface.d.ts +2 -0
  54. package/dist/interfaces/userInstituteMetaInterface.d.ts +2 -0
  55. package/dist/interfaces/workingDayInterface.d.ts +1 -0
  56. package/dist/interfaces/workingShiftInterface.d.ts +1 -0
  57. package/dist/models/mongodb/feeReminderTypeModel.js +4 -0
  58. package/dist/models/mongodb/subjectIndexModel.js +8 -0
  59. package/dist/models/mongodb/userInstituteMetaModel.js +8 -0
  60. package/dist/models/psql/accountHasReceiptDetailsModel.d.ts +2 -0
  61. package/dist/models/psql/accountHasReceiptDetailsModel.js +27 -1
  62. package/dist/models/psql/bankAccountDetailsModel.d.ts +1 -0
  63. package/dist/models/psql/bankAccountDetailsModel.js +13 -0
  64. package/dist/models/psql/batchModel.d.ts +1 -0
  65. package/dist/models/psql/batchModel.js +13 -0
  66. package/dist/models/psql/classRoomModel.d.ts +1 -0
  67. package/dist/models/psql/classRoomModel.js +13 -0
  68. package/dist/models/psql/feeHistoryModel.js +1 -0
  69. package/dist/models/psql/feeReminderSettingModel.d.ts +1 -0
  70. package/dist/models/psql/feeReminderSettingModel.js +12 -0
  71. package/dist/models/psql/floorManagementModel.d.ts +2 -0
  72. package/dist/models/psql/floorManagementModel.js +27 -1
  73. package/dist/models/psql/greetingsModel.d.ts +1 -0
  74. package/dist/models/psql/greetingsModel.js +13 -0
  75. package/dist/models/psql/incomeExpenseModel.d.ts +1 -1
  76. package/dist/models/psql/incomeExpenseModel.js +6 -6
  77. package/dist/models/psql/masterLeaveModel.d.ts +1 -0
  78. package/dist/models/psql/masterLeaveModel.js +13 -0
  79. package/dist/models/psql/roleModel.d.ts +2 -0
  80. package/dist/models/psql/roleModel.js +27 -1
  81. package/dist/models/psql/slotModel.d.ts +1 -0
  82. package/dist/models/psql/slotModel.js +13 -0
  83. package/dist/models/psql/subjectHasFeeModel.d.ts +2 -1
  84. package/dist/models/psql/subjectHasFeeModel.js +14 -1
  85. package/dist/models/psql/typeManagementModel.d.ts +2 -0
  86. package/dist/models/psql/typeManagementModel.js +39 -1
  87. package/dist/models/psql/userHasRoleModel.d.ts +2 -0
  88. package/dist/models/psql/userHasRoleModel.js +27 -1
  89. package/dist/models/psql/workingDayModel.d.ts +1 -0
  90. package/dist/models/psql/workingDayModel.js +13 -0
  91. package/dist/models/psql/workingShiftModel.d.ts +1 -0
  92. package/dist/models/psql/workingShiftModel.js +13 -0
  93. package/package.json +1 -1
@@ -6,4 +6,5 @@ export interface ISlotModelAttributes extends IDefaultAttributes {
6
6
  instituteId: string;
7
7
  type: SCHOOL_SHIFT;
8
8
  academicCalendarId?: string;
9
+ oldId?: string;
9
10
  }
@@ -7,4 +7,5 @@ export interface ISubjectHasFeeModelAttributes extends IDefaultAttributes {
7
7
  academicCalendarId?: string;
8
8
  batchId?: string;
9
9
  batchType?: string;
10
+ oldId?: string;
10
11
  }
@@ -46,4 +46,6 @@ export interface ISubjectIndexModelAttributes extends IDefaultAttributes, Docume
46
46
  assignedUsers?: IAssignedUsersAttributes[];
47
47
  selectedCategoryIds?: string[];
48
48
  courseId?: string;
49
+ academicCalendarId?: string;
50
+ oldId?: string;
49
51
  }
@@ -8,4 +8,6 @@ export interface ITypeManagementModelAttributes extends IDefaultAttributes {
8
8
  type: TYPE_MANAGEMENT_TYPE;
9
9
  isInstituteDefault?: boolean;
10
10
  isDefault?: boolean;
11
+ academicCalendarId?: string;
12
+ oldId?: string;
11
13
  }
@@ -10,4 +10,6 @@ export interface IUserHasRoleAttributes extends IDefaultAttributes {
10
10
  updatedBy?: string;
11
11
  createdAt?: Date;
12
12
  updatedAt?: Date;
13
+ oldId?: string;
14
+ academicCalendarId?: string;
13
15
  }
@@ -38,4 +38,6 @@ export interface IUserInstituteMetaAttributes extends IDefaultAttributes, Docume
38
38
  lastGreetingDate?: Date;
39
39
  isSyncToSubscriptionPlan?: boolean;
40
40
  academicCalendarId?: string;
41
+ oldId?: string;
42
+ previousEntities?: string[];
41
43
  }
@@ -9,4 +9,5 @@ export interface IWorkingDayAttributes extends IDefaultAttributes {
9
9
  instituteId?: string;
10
10
  dayOfWeek: number;
11
11
  academicCalendarId?: string;
12
+ oldId?: string;
12
13
  }
@@ -10,4 +10,5 @@ export interface IWorkingShiftAttributes extends IDefaultAttributes {
10
10
  shiftType: SCHOOL_SHIFT;
11
11
  instituteId?: string;
12
12
  academicCalendarId?: string;
13
+ oldId?: string;
13
14
  }
@@ -57,6 +57,10 @@ const feeReminderTypeModelSchema = new mongoose_1.Schema({
57
57
  type: String,
58
58
  required: false,
59
59
  },
60
+ oldId: {
61
+ type: String,
62
+ required: false,
63
+ },
60
64
  createdBy: {
61
65
  type: String,
62
66
  required: false,
@@ -224,6 +224,14 @@ const SubjectIndexSchema = new mongoose_1.Schema({
224
224
  type: String,
225
225
  required: false,
226
226
  },
227
+ academicCalendarId: {
228
+ type: String,
229
+ required: false,
230
+ },
231
+ oldId: {
232
+ type: String,
233
+ required: false,
234
+ },
227
235
  }, {
228
236
  timestamps: true, // Adds createdAt and updatedAt fields
229
237
  versionKey: false, // Disables the __v field
@@ -190,6 +190,14 @@ const userInstituteMetaSchema = new mongoose_1.Schema({
190
190
  type: Boolean,
191
191
  default: false,
192
192
  },
193
+ oldId: {
194
+ type: String,
195
+ required: false,
196
+ },
197
+ previousEntities: {
198
+ type: [String],
199
+ required: false
200
+ }
193
201
  }, {
194
202
  timestamps: true,
195
203
  versionKey: false,
@@ -16,6 +16,8 @@ export declare class AccountHasReceiptDetailsModel extends Model<IAccountHasRece
16
16
  name: string;
17
17
  landline: string;
18
18
  instituteId: string;
19
+ oldId?: string;
20
+ academicCalendarId?: string;
19
21
  createdBy?: string;
20
22
  updatedBy?: string;
21
23
  deletedBy?: string;
@@ -5,7 +5,7 @@ const sequelize_1 = require("sequelize");
5
5
  const index_1 = require("./index");
6
6
  class AccountHasReceiptDetailsModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { InstituteModel, UserModel, FileStorageModel, BankAccountDetailsModel } = models;
8
+ const { InstituteModel, UserModel, FileStorageModel, BankAccountDetailsModel, AcademicCalendarModel } = models;
9
9
  // Institute ↔ Receipt Details
10
10
  AccountHasReceiptDetailsModel.belongsTo(InstituteModel, {
11
11
  foreignKey: { name: 'instituteId', field: 'institute_id' },
@@ -46,6 +46,22 @@ class AccountHasReceiptDetailsModel extends sequelize_1.Model {
46
46
  foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
47
47
  as: 'deletedByUser',
48
48
  });
49
+ AccountHasReceiptDetailsModel.belongsTo(AcademicCalendarModel, {
50
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
51
+ as: 'accHasReceiptAcaCal',
52
+ });
53
+ AcademicCalendarModel.hasMany(AccountHasReceiptDetailsModel, {
54
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
55
+ as: 'AcaCalAccHasReceipt',
56
+ });
57
+ AccountHasReceiptDetailsModel.belongsTo(AccountHasReceiptDetailsModel, {
58
+ foreignKey: { name: 'oldId', field: 'old_id' },
59
+ as: 'accHasReceiptParent',
60
+ });
61
+ AccountHasReceiptDetailsModel.hasMany(AccountHasReceiptDetailsModel, {
62
+ foreignKey: { name: 'oldId', field: 'old_id' },
63
+ as: 'childAccHasReceipt',
64
+ });
49
65
  }
50
66
  }
51
67
  exports.AccountHasReceiptDetailsModel = AccountHasReceiptDetailsModel;
@@ -115,6 +131,16 @@ AccountHasReceiptDetailsModel.init({
115
131
  allowNull: false,
116
132
  field: 'bank_id',
117
133
  },
134
+ academicCalendarId: {
135
+ type: sequelize_1.DataTypes.UUID,
136
+ allowNull: true,
137
+ field: 'academic_calendar_id',
138
+ },
139
+ oldId: {
140
+ type: sequelize_1.DataTypes.UUID,
141
+ allowNull: true,
142
+ field: 'old_id',
143
+ },
118
144
  }, {
119
145
  modelName: 'AccountHasReceiptDetailsModel',
120
146
  tableName: 'account_has_receipt_details',
@@ -14,6 +14,7 @@ export declare class BankAccountDetailsModel extends Model<IBankAccountDetailsIn
14
14
  isDefault: BOOLEAN_STATUS;
15
15
  isSelfAccount: BOOLEAN_STATUS;
16
16
  academicCalendarId: string;
17
+ oldId?: string;
17
18
  createdBy?: string;
18
19
  updatedBy?: string;
19
20
  deletedBy?: string;
@@ -31,6 +31,14 @@ class BankAccountDetailsModel extends sequelize_1.Model {
31
31
  foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
32
32
  as: 'bankAccDAcademicCal',
33
33
  });
34
+ BankAccountDetailsModel.belongsTo(BankAccountDetailsModel, {
35
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
36
+ as: 'parentBankAccDetails',
37
+ });
38
+ BankAccountDetailsModel.hasMany(BankAccountDetailsModel, {
39
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
40
+ as: 'childBankAccDetails',
41
+ });
34
42
  }
35
43
  }
36
44
  exports.BankAccountDetailsModel = BankAccountDetailsModel;
@@ -88,6 +96,11 @@ BankAccountDetailsModel.init({
88
96
  allowNull: false,
89
97
  defaultValue: app_1.BOOLEAN_STATUS.NO,
90
98
  },
99
+ oldId: {
100
+ type: sequelize_1.DataTypes.UUID,
101
+ field: 'old_id',
102
+ allowNull: true,
103
+ },
91
104
  }, {
92
105
  modelName: 'BankAccountDetailsModel',
93
106
  tableName: 'bank_account_details',
@@ -17,6 +17,7 @@ export declare class BatchModel extends Model<IBatchModelAttributes, TBatchModel
17
17
  teacherId: string;
18
18
  plannerSyncStatus: PLANNER_SYNC_STATUS;
19
19
  academicCalendarId: string;
20
+ oldId?: string;
20
21
  createdBy: string;
21
22
  updatedBy: string;
22
23
  deletedBy: string;
@@ -63,6 +63,14 @@ class BatchModel extends sequelize_1.Model {
63
63
  foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id', allowNull: true },
64
64
  as: 'academicCalendarBatchList',
65
65
  });
66
+ BatchModel.belongsTo(BatchModel, {
67
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
68
+ as: 'batchListParent',
69
+ });
70
+ BatchModel.hasMany(BatchModel, {
71
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
72
+ as: 'childBatchList',
73
+ });
66
74
  }
67
75
  static addHooks() {
68
76
  BatchModel.afterBulkCreate(async (instances, options) => {
@@ -152,6 +160,11 @@ BatchModel.init({
152
160
  field: 'academic_calendar_id',
153
161
  allowNull: true,
154
162
  },
163
+ oldId: {
164
+ type: sequelize_1.DataTypes.UUID,
165
+ field: 'old_id',
166
+ allowNull: true,
167
+ },
155
168
  }, {
156
169
  modelName: 'BatchModel',
157
170
  tableName: 'batches',
@@ -13,6 +13,7 @@ export declare class ClassRoomModel extends Model<IClassRoomModelAttributes, TCl
13
13
  floorId: string;
14
14
  typeManagementId?: string;
15
15
  academicCalendarId?: string;
16
+ oldId?: string;
16
17
  createdBy: string;
17
18
  updatedBy: string;
18
19
  deletedBy: string;
@@ -57,6 +57,14 @@ class ClassRoomModel extends sequelize_1.Model {
57
57
  },
58
58
  as: 'AcademicCalClassroom',
59
59
  });
60
+ ClassRoomModel.belongsTo(ClassRoomModel, {
61
+ foreignKey: { name: 'oldId', field: 'old_id' },
62
+ as: 'classRoomParent',
63
+ });
64
+ ClassRoomModel.hasMany(ClassRoomModel, {
65
+ foreignKey: { name: 'oldId', field: 'old_id' },
66
+ as: 'childClassRoom',
67
+ });
60
68
  }
61
69
  }
62
70
  exports.ClassRoomModel = ClassRoomModel;
@@ -110,6 +118,11 @@ ClassRoomModel.init({
110
118
  field: 'academic_calendar_id',
111
119
  allowNull: true,
112
120
  },
121
+ oldId: {
122
+ type: sequelize_1.DataTypes.UUID,
123
+ field: 'old_id',
124
+ allowNull: true,
125
+ }
113
126
  }, {
114
127
  modelName: 'ClassRoomModel',
115
128
  tableName: 'class_rooms',
@@ -177,6 +177,7 @@ FeeHistoryModel.init({
177
177
  bankName: { type: sequelize_1.DataTypes.STRING, allowNull: true },
178
178
  chequeNo: { type: sequelize_1.DataTypes.STRING, allowNull: true },
179
179
  upiId: { type: sequelize_1.DataTypes.STRING, allowNull: true },
180
+ academicCalendarId: { type: sequelize_1.DataTypes.UUID, field: 'academic_calendar_id', allowNull: true },
180
181
  }, {
181
182
  modelName: 'FeeHistoryModel',
182
183
  tableName: 'fee_history',
@@ -9,6 +9,7 @@ declare class FeeReminderSettingModel extends Model<IFeeReminderSettingModelAttr
9
9
  status: FEE_REMINDER_SETTING_STATUS;
10
10
  typeId: string;
11
11
  default: BOOLEAN_STATUS;
12
+ oldId: string;
12
13
  academicCalendarId: string;
13
14
  createdBy: string;
14
15
  updatedBy: string;
@@ -34,6 +34,14 @@ class FeeReminderSettingModel extends sequelize_1.Model {
34
34
  foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
35
35
  as: 'deletedByUser',
36
36
  });
37
+ FeeReminderSettingModel.belongsTo(FeeReminderSettingModel, {
38
+ foreignKey: { name: 'oldId', field: 'old_id' },
39
+ as: 'reminderSettingParent',
40
+ });
41
+ FeeReminderSettingModel.hasMany(FeeReminderSettingModel, {
42
+ foreignKey: { name: 'oldId', field: 'old_id' },
43
+ as: 'childReminderSetting',
44
+ });
37
45
  }
38
46
  }
39
47
  FeeReminderSettingModel.init({
@@ -71,6 +79,10 @@ FeeReminderSettingModel.init({
71
79
  type: sequelize_1.DataTypes.STRING,
72
80
  allowNull: true,
73
81
  },
82
+ oldId: {
83
+ type: sequelize_1.DataTypes.UUID,
84
+ allowNull: true
85
+ }
74
86
  }, {
75
87
  modelName: 'FeeReminderSettingModel',
76
88
  tableName: 'fee_reminder_settings',
@@ -8,6 +8,8 @@ declare class FloorManagementModel extends Model<IFloorManagementModelAttributes
8
8
  floorNumber: number;
9
9
  status: COMMAN_STATUS;
10
10
  instituteId: string;
11
+ oldId?: string;
12
+ academicCalendarId?: string;
11
13
  createdBy: string;
12
14
  updatedBy: string;
13
15
  deletedBy: string;
@@ -5,7 +5,7 @@ const index_1 = require("./index");
5
5
  const app_1 = require("../../constants/app");
6
6
  class FloorManagementModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { UserModel, InstituteModel } = models;
8
+ const { UserModel, InstituteModel, AcademicCalendarModel } = models;
9
9
  FloorManagementModel.belongsTo(UserModel, {
10
10
  foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
11
11
  as: 'createdByUser',
@@ -26,6 +26,22 @@ class FloorManagementModel extends sequelize_1.Model {
26
26
  foreignKey: { name: 'instituteId' },
27
27
  as: 'instituteFloorList',
28
28
  });
29
+ FloorManagementModel.belongsTo(AcademicCalendarModel, {
30
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
31
+ as: 'floorAcaCal',
32
+ });
33
+ AcademicCalendarModel.hasMany(FloorManagementModel, {
34
+ foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
35
+ as: 'AcaCalFloorList',
36
+ });
37
+ FloorManagementModel.belongsTo(FloorManagementModel, {
38
+ foreignKey: { name: 'oldId', field: 'old_id' },
39
+ as: 'parentFloorList',
40
+ });
41
+ FloorManagementModel.hasMany(FloorManagementModel, {
42
+ foreignKey: { name: 'oldId', field: 'old_id' },
43
+ as: 'childFloorList',
44
+ });
29
45
  }
30
46
  }
31
47
  FloorManagementModel.init({
@@ -54,6 +70,16 @@ FloorManagementModel.init({
54
70
  field: 'institute_id',
55
71
  allowNull: false,
56
72
  },
73
+ academicCalendarId: {
74
+ type: sequelize_1.DataTypes.UUID,
75
+ field: 'academic_calendar_id',
76
+ allowNull: true,
77
+ },
78
+ oldId: {
79
+ type: sequelize_1.DataTypes.UUID,
80
+ field: 'old_id',
81
+ allowNull: true,
82
+ }
57
83
  }, {
58
84
  modelName: 'FloorManagementModel',
59
85
  tableName: 'floor_management',
@@ -12,6 +12,7 @@ export default class GreetingsModel extends Model<IGreetingsModelAttributes, TGr
12
12
  title: string;
13
13
  image: string;
14
14
  academicCalendarId: string;
15
+ oldId?: string;
15
16
  createdBy: string;
16
17
  updatedBy: string;
17
18
  deletedBy: string;
@@ -61,6 +61,14 @@ class GreetingsModel extends sequelize_1.Model {
61
61
  foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
62
62
  as: 'academicCalendarGreetings',
63
63
  });
64
+ GreetingsModel.belongsTo(GreetingsModel, {
65
+ foreignKey: { name: 'oldId', field: 'old_id' },
66
+ as: 'GreetingsParent',
67
+ });
68
+ GreetingsModel.hasMany(GreetingsModel, {
69
+ foreignKey: { name: 'oldId', field: 'old_id' },
70
+ as: 'GreetingsChild',
71
+ });
64
72
  }
65
73
  static addHooks(models) {
66
74
  const beforeCreateOrUpdateHook = async (greetings) => {
@@ -121,6 +129,11 @@ GreetingsModel.init({
121
129
  defaultValue: false,
122
130
  allowNull: true,
123
131
  },
132
+ oldId: {
133
+ type: sequelize_1.DataTypes.UUID,
134
+ field: 'old_id',
135
+ allowNull: true,
136
+ },
124
137
  }, {
125
138
  modelName: 'GreetingsModel',
126
139
  tableName: 'greeting',
@@ -8,7 +8,7 @@ export declare class IncomeExpenseModel extends Model<IIncomeExpenseModelAttribu
8
8
  source: string;
9
9
  amount: number;
10
10
  instituteId: string;
11
- academicCalenderId: string;
11
+ academicCalendarId: string;
12
12
  static associate(models: any): void;
13
13
  }
14
14
  export default IncomeExpenseModel;
@@ -43,15 +43,15 @@ class IncomeExpenseModel extends sequelize_1.Model {
43
43
  });
44
44
  IncomeExpenseModel.belongsTo(AcademicCalendarModel, {
45
45
  foreignKey: {
46
- name: 'academicCalenderId',
47
- field: 'academic_calender_id',
46
+ name: 'academicCalendarId',
47
+ field: 'academic_calendar_id',
48
48
  },
49
49
  as: 'incomeExpenseAcademicCalender',
50
50
  });
51
51
  AcademicCalendarModel.hasMany(IncomeExpenseModel, {
52
52
  foreignKey: {
53
- name: 'academicCalenderId',
54
- field: 'academic_calender_id',
53
+ name: 'academicCalendarId',
54
+ field: 'academic_calendar_id',
55
55
  },
56
56
  as: 'AcademicCalenderIncomeExpense',
57
57
  });
@@ -70,9 +70,9 @@ IncomeExpenseModel.init({
70
70
  field: 'institute_id',
71
71
  allowNull: true,
72
72
  },
73
- academicCalenderId: {
73
+ academicCalendarId: {
74
74
  type: sequelize_1.DataTypes.UUID,
75
- field: 'academic_calender_id',
75
+ field: 'academic_calendar_id',
76
76
  allowNull: true,
77
77
  },
78
78
  type: {
@@ -13,6 +13,7 @@ declare class MasterLeaveModel extends Model<IMasterLeaveModelAttributes, TMaste
13
13
  leave: LEAVE;
14
14
  status: COMMAN_STATUS;
15
15
  academicCalendarId: string;
16
+ oldId?: string;
16
17
  createdBy: string;
17
18
  updatedBy: string;
18
19
  deletedBy: string;
@@ -83,6 +83,14 @@ class MasterLeaveModel extends sequelize_1.Model {
83
83
  foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id', allowNull: true },
84
84
  as: 'acaCalMasterLeave',
85
85
  });
86
+ MasterLeaveModel.belongsTo(MasterLeaveModel, {
87
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
88
+ as: 'masterLeaveParent',
89
+ });
90
+ MasterLeaveModel.hasMany(MasterLeaveModel, {
91
+ foreignKey: { name: 'oldId', field: 'old_id', allowNull: true },
92
+ as: 'childMasterLeave',
93
+ });
86
94
  }
87
95
  }
88
96
  MasterLeaveModel.init({
@@ -135,6 +143,11 @@ MasterLeaveModel.init({
135
143
  field: 'academic_calendar_id',
136
144
  allowNull: true,
137
145
  },
146
+ oldId: {
147
+ type: sequelize_1.DataTypes.UUID,
148
+ field: 'old_id',
149
+ allowNull: true,
150
+ },
138
151
  }, {
139
152
  modelName: 'MasterLeaveModel',
140
153
  tableName: 'master_leaves',
@@ -12,6 +12,8 @@ declare class RoleModel extends Model<IRoleAttributes, TRoleCreationAttributes>
12
12
  userType: USER_TYPES;
13
13
  appType: APP_TYPE;
14
14
  isInstituteDefault?: boolean;
15
+ oldId?: string;
16
+ academicCalendarId?: string;
15
17
  createdBy: string;
16
18
  updatedBy: string;
17
19
  deletedBy: string;
@@ -5,7 +5,7 @@ const index_1 = require("./index");
5
5
  const app_1 = require("../../constants/app");
6
6
  class RoleModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { UserModel } = models;
8
+ const { UserModel, AcademicCalendarModel } = models;
9
9
  RoleModel.belongsTo(UserModel, {
10
10
  foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
11
11
  as: 'createdByUser',
@@ -18,6 +18,22 @@ class RoleModel extends sequelize_1.Model {
18
18
  foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
19
19
  as: 'deletedByUser',
20
20
  });
21
+ RoleModel.belongsTo(RoleModel, {
22
+ foreignKey: { name: 'oldId', allowNull: true, field: 'old_id' },
23
+ as: 'oldParentRole',
24
+ });
25
+ RoleModel.hasMany(RoleModel, {
26
+ foreignKey: { name: 'oldId', allowNull: true, field: 'old_id' },
27
+ as: 'childOldRole',
28
+ });
29
+ RoleModel.belongsTo(AcademicCalendarModel, {
30
+ foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
31
+ as: 'roleAcaCal',
32
+ });
33
+ AcademicCalendarModel.hasMany(RoleModel, {
34
+ foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
35
+ as: 'AcaCalRole',
36
+ });
21
37
  }
22
38
  }
23
39
  RoleModel.init({
@@ -65,6 +81,16 @@ RoleModel.init({
65
81
  field: 'is_institute_default',
66
82
  defaultValue: false,
67
83
  },
84
+ oldId: {
85
+ type: sequelize_1.DataTypes.UUID,
86
+ field: 'old_id',
87
+ allowNull: true,
88
+ },
89
+ academicCalendarId: {
90
+ type: sequelize_1.DataTypes.UUID,
91
+ field: 'academic_calendar_id',
92
+ allowNull: true,
93
+ }
68
94
  }, {
69
95
  modelName: 'RoleModel',
70
96
  tableName: 'roles',
@@ -8,6 +8,7 @@ declare class SlotModel extends Model<ISlotModelAttributes, TSlotModelCreationAt
8
8
  instituteId: string;
9
9
  type: SCHOOL_SHIFT;
10
10
  academicCalendarId?: string;
11
+ oldId?: string;
11
12
  createdBy: string;
12
13
  updatedBy: string;
13
14
  deletedBy: string;
@@ -35,6 +35,14 @@ class SlotModel extends sequelize_1.Model {
35
35
  foreignKey: 'academicCalendarId',
36
36
  as: 'academicCalSlot',
37
37
  });
38
+ SlotModel.belongsTo(SlotModel, {
39
+ foreignKey: { name: 'oldId', field: 'old_id' },
40
+ as: 'slotParent',
41
+ });
42
+ SlotModel.hasMany(SlotModel, {
43
+ foreignKey: { name: 'oldId', field: 'old_id' },
44
+ as: 'childSlot',
45
+ });
38
46
  }
39
47
  static addHooks(models) {
40
48
  const { InstituteModel } = models;
@@ -83,6 +91,11 @@ SlotModel.init({
83
91
  field: 'academic_calendar_id',
84
92
  allowNull: true,
85
93
  },
94
+ oldId: {
95
+ type: sequelize_1.DataTypes.UUID,
96
+ field: 'old_id',
97
+ allowNull: true,
98
+ }
86
99
  }, {
87
100
  modelName: 'SlotModel',
88
101
  tableName: 'slots',
@@ -6,9 +6,10 @@ declare class SubjectHasFeeModel extends Model<ISubjectHasFeeModelAttributes, TS
6
6
  instituteId: string;
7
7
  subjectId: string;
8
8
  fee: number;
9
- academicCalenderId?: string;
9
+ academicCalendarId?: string;
10
10
  batchId?: string;
11
11
  batchType?: string;
12
+ oldId?: string;
12
13
  createdBy: string;
13
14
  updatedBy: string;
14
15
  deletedBy: string;
@@ -75,6 +75,14 @@ class SubjectHasFeeModel extends sequelize_1.Model {
75
75
  },
76
76
  as: 'deletedByUser',
77
77
  });
78
+ SubjectHasFeeModel.belongsTo(SubjectHasFeeModel, {
79
+ foreignKey: { name: 'oldId', field: 'old_id' },
80
+ as: 'subHFeeParent',
81
+ });
82
+ SubjectHasFeeModel.hasMany(SubjectHasFeeModel, {
83
+ foreignKey: { name: 'oldId', field: 'old_id' },
84
+ as: 'childSubHFee',
85
+ });
78
86
  }
79
87
  }
80
88
  SubjectHasFeeModel.init({
@@ -98,7 +106,7 @@ SubjectHasFeeModel.init({
98
106
  },
99
107
  academicCalendarId: {
100
108
  type: sequelize_1.DataTypes.UUID,
101
- field: 'academic_calender_id',
109
+ field: 'academic_calendar_id',
102
110
  allowNull: true,
103
111
  },
104
112
  batchId: {
@@ -111,6 +119,11 @@ SubjectHasFeeModel.init({
111
119
  field: 'batch_type',
112
120
  allowNull: true,
113
121
  },
122
+ oldId: {
123
+ type: sequelize_1.DataTypes.UUID,
124
+ field: 'old_id',
125
+ allowNull: true,
126
+ },
114
127
  }, {
115
128
  modelName: 'SubjectHasFeeModel',
116
129
  tableName: 'subject_has_fee',
@@ -10,6 +10,8 @@ declare class TypeManagementModel extends Model<ITypeManagementModelAttributes,
10
10
  type: TYPE_MANAGEMENT_TYPE;
11
11
  isInstituteDefault: boolean;
12
12
  isDefault: boolean;
13
+ academicCalendarId?: string;
14
+ oldId?: string;
13
15
  createdBy: string;
14
16
  updatedBy: string;
15
17
  deletedBy: string;