@kipicore/dbcore 1.1.5 → 1.1.8

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 (73) hide show
  1. package/README.md +1 -1
  2. package/dist/constants/app.js +0 -1
  3. package/dist/db/mongodb.js +4 -4
  4. package/dist/db/postgres.d.ts +1 -1
  5. package/dist/db/postgres.js +5 -5
  6. package/dist/index.d.ts +419 -415
  7. package/dist/index.js +748 -428
  8. package/dist/models/mongodb/attendanceModel.d.ts +2 -2
  9. package/dist/models/mongodb/attendanceModel.js +7 -8
  10. package/dist/models/mongodb/eventModel.d.ts +2 -2
  11. package/dist/models/mongodb/eventModel.js +3 -3
  12. package/dist/models/mongodb/examGroupModel.d.ts +2 -2
  13. package/dist/models/mongodb/examGroupModel.js +22 -28
  14. package/dist/models/mongodb/examHasAnswerSheetModel.d.ts +2 -2
  15. package/dist/models/mongodb/examHasAnswerSheetModel.js +5 -6
  16. package/dist/models/mongodb/examModel.d.ts +2 -2
  17. package/dist/models/mongodb/examModel.js +7 -10
  18. package/dist/models/mongodb/holidayModel.d.ts +2 -2
  19. package/dist/models/mongodb/holidayModel.js +4 -6
  20. package/dist/models/mongodb/inquiryModel.d.ts +2 -2
  21. package/dist/models/mongodb/inquiryModel.js +3 -4
  22. package/dist/models/mongodb/plugin/transformIdInResponsePlugin.d.ts +1 -1
  23. package/dist/models/mongodb/plugin/transformIdInResponsePlugin.js +4 -6
  24. package/dist/models/mongodb/schoolFeeModel.d.ts +2 -2
  25. package/dist/models/mongodb/schoolFeeModel.js +3 -3
  26. package/dist/models/mongodb/subjectIndexModel.d.ts +2 -2
  27. package/dist/models/mongodb/subjectIndexModel.js +66 -108
  28. package/dist/models/mongodb/subscriptionPlanModel.d.ts +2 -2
  29. package/dist/models/mongodb/subscriptionPlanModel.js +1 -1
  30. package/dist/models/mongodb/taskManagementModel.d.ts +2 -2
  31. package/dist/models/mongodb/taskManagementModel.js +3 -3
  32. package/dist/models/mongodb/userDoc.d.ts +1 -1
  33. package/dist/models/mongodb/userDoc.js +1 -1
  34. package/dist/models/mongodb/userSchoolMetaModel.d.ts +1 -1
  35. package/dist/models/mongodb/userSchoolMetaModel.js +8 -8
  36. package/dist/models/psql/announcementModel.d.ts +4 -4
  37. package/dist/models/psql/announcementModel.js +25 -25
  38. package/dist/models/psql/batchModel.d.ts +4 -4
  39. package/dist/models/psql/batchModel.js +51 -51
  40. package/dist/models/psql/driverModel.d.ts +4 -4
  41. package/dist/models/psql/driverModel.js +28 -28
  42. package/dist/models/psql/facilityModel.d.ts +4 -4
  43. package/dist/models/psql/facilityModel.js +23 -23
  44. package/dist/models/psql/feeHistoryModel.d.ts +4 -4
  45. package/dist/models/psql/feeHistoryModel.js +64 -65
  46. package/dist/models/psql/feeReminderModel.d.ts +3 -3
  47. package/dist/models/psql/feeReminderModel.js +32 -32
  48. package/dist/models/psql/feesCollectionModel.d.ts +4 -4
  49. package/dist/models/psql/feesCollectionModel.js +36 -37
  50. package/dist/models/psql/index.d.ts +1 -1
  51. package/dist/models/psql/index.js +12 -12
  52. package/dist/models/psql/lectureModel.d.ts +4 -4
  53. package/dist/models/psql/lectureModel.js +75 -84
  54. package/dist/models/psql/masterLeaveModel.d.ts +4 -4
  55. package/dist/models/psql/masterLeaveModel.js +22 -23
  56. package/dist/models/psql/testimonialModel.d.ts +4 -4
  57. package/dist/models/psql/testimonialModel.js +25 -27
  58. package/dist/models/psql/toDoModel.d.ts +4 -4
  59. package/dist/models/psql/toDoModel.js +23 -23
  60. package/dist/models/psql/typeManagementModel.d.ts +4 -4
  61. package/dist/models/psql/typeManagementModel.js +19 -19
  62. package/dist/models/psql/userModel.d.ts +4 -4
  63. package/dist/models/psql/userModel.js +47 -48
  64. package/dist/models/psql/userPayoutModel.d.ts +4 -4
  65. package/dist/models/psql/userPayoutModel.js +55 -70
  66. package/dist/services/Concrete/mongooseCommonService.d.ts +4 -4
  67. package/dist/services/Concrete/mongooseCommonService.js +2 -4
  68. package/dist/services/Contracts/IMongooseCommonService.d.ts +2 -2
  69. package/dist/services/Contracts/ISequelizeCommonService.d.ts +12 -12
  70. package/dist/types/generateIdCardType.d.ts +2 -2
  71. package/package.json +49 -47
  72. /package/dist/services/Concrete/{sequelizeCommanService.d.ts → sequelizeCommonService.d.ts} +0 -0
  73. /package/dist/services/Concrete/{sequelizeCommanService.js → sequelizeCommonService.js} +0 -0
@@ -26,30 +26,30 @@ UserPayoutModel.init({
26
26
  userId: {
27
27
  type: sequelize_1.DataTypes.UUID,
28
28
  allowNull: false,
29
- field: "user_id",
29
+ field: 'user_id',
30
30
  },
31
31
  userType: {
32
32
  type: sequelize_1.DataTypes.ENUM,
33
33
  values: Object.values(app_js_1.USER_TYPES),
34
34
  allowNull: false,
35
- field: "user_type",
35
+ field: 'user_type',
36
36
  },
37
37
  instituteId: {
38
38
  type: sequelize_1.DataTypes.UUID,
39
39
  allowNull: false,
40
- field: "institute_id",
40
+ field: 'institute_id',
41
41
  },
42
42
  totalPayableAmount: {
43
43
  type: sequelize_1.DataTypes.FLOAT,
44
44
  allowNull: true,
45
45
  defaultValue: 0,
46
- field: "total_payable_amount",
46
+ field: 'total_payable_amount',
47
47
  },
48
48
  totalPaidAmount: {
49
49
  type: sequelize_1.DataTypes.FLOAT,
50
50
  allowNull: true,
51
51
  defaultValue: 0,
52
- field: "total_paid_amount",
52
+ field: 'total_paid_amount',
53
53
  },
54
54
  type: {
55
55
  type: sequelize_1.DataTypes.ENUM,
@@ -59,68 +59,67 @@ UserPayoutModel.init({
59
59
  lastCalculatedAt: {
60
60
  type: sequelize_1.DataTypes.DATE,
61
61
  defaultValue: (0, date_fns_1.startOfToday)(),
62
- field: "last_calculated_at",
62
+ field: 'last_calculated_at',
63
63
  },
64
64
  }, {
65
- modelName: "UserPayoutModel",
66
- tableName: "user_payouts",
65
+ modelName: 'UserPayoutModel',
66
+ tableName: 'user_payouts',
67
67
  timestamps: true,
68
68
  sequelize: index_js_1.sequelize,
69
69
  });
70
70
  UserPayoutModel.belongsTo(userModel_js_1.default, {
71
71
  foreignKey: {
72
- name: "createdBy",
72
+ name: 'createdBy',
73
73
  allowNull: true,
74
- field: "created_by",
74
+ field: 'created_by',
75
75
  },
76
- as: "createdByUser",
76
+ as: 'createdByUser',
77
77
  });
78
78
  UserPayoutModel.belongsTo(userModel_js_1.default, {
79
79
  foreignKey: {
80
- name: "updatedBy",
80
+ name: 'updatedBy',
81
81
  allowNull: true,
82
- field: "updated_by",
82
+ field: 'updated_by',
83
83
  },
84
- as: "updatedByUser",
84
+ as: 'updatedByUser',
85
85
  });
86
86
  UserPayoutModel.belongsTo(userModel_js_1.default, {
87
87
  foreignKey: {
88
- name: "deletedBy",
88
+ name: 'deletedBy',
89
89
  allowNull: true,
90
- field: "deleted_by",
90
+ field: 'deleted_by',
91
91
  },
92
- as: "deletedByUser",
92
+ as: 'deletedByUser',
93
93
  });
94
94
  UserPayoutModel.belongsTo(instituteModel_js_1.default, {
95
95
  foreignKey: {
96
- name: "instituteId",
96
+ name: 'instituteId',
97
97
  },
98
- as: "institute",
98
+ as: 'institute',
99
99
  });
100
100
  instituteModel_js_1.default.hasMany(UserPayoutModel, {
101
101
  foreignKey: {
102
- name: "instituteId",
102
+ name: 'instituteId',
103
103
  },
104
- as: "instituteHasPayoutList",
104
+ as: 'instituteHasPayoutList',
105
105
  });
106
106
  UserPayoutModel.belongsTo(userModel_js_1.default, {
107
107
  foreignKey: {
108
- name: "userId",
108
+ name: 'userId',
109
109
  },
110
- as: "user",
110
+ as: 'user',
111
111
  });
112
112
  userModel_js_1.default.hasMany(UserPayoutModel, {
113
113
  foreignKey: {
114
- name: "userId",
114
+ name: 'userId',
115
115
  },
116
- as: "userHasPayoutList",
116
+ as: 'userHasPayoutList',
117
117
  });
118
118
  const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, filterOptions = {}) => {
119
119
  try {
120
- if (!userPayout.userPayoutDetailsList ||
121
- !userPayout.userPayoutDetailsList.length)
120
+ if (!userPayout.userPayoutDetailsList || !userPayout.userPayoutDetailsList.length)
122
121
  return userPayout;
123
- userPayout.userPayoutDetailsList = (0, utils_js_1.getUniqueArrayByFields)(userPayout.userPayoutDetailsList, ["subjectId"]);
122
+ userPayout.userPayoutDetailsList = (0, utils_js_1.getUniqueArrayByFields)(userPayout.userPayoutDetailsList, ['subjectId']);
124
123
  const options = {
125
124
  transaction,
126
125
  };
@@ -131,14 +130,10 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
131
130
  let startOfPreviousMonth = (0, date_fns_1.startOfMonth)(previousMonthDate).toISOString();
132
131
  let endOfPreviousMonth = (0, date_fns_1.endOfMonth)(previousMonthDate).toISOString();
133
132
  if (filterOptions.include) {
134
- filterOptions.include = !Array.isArray(filterOptions.include)
135
- ? [filterOptions.include]
136
- : filterOptions.include;
137
- const historyListInclude = filterOptions.include.find((include) => include.as === "userPayoutHistoryList");
133
+ filterOptions.include = !Array.isArray(filterOptions.include) ? [filterOptions.include] : filterOptions.include;
134
+ const historyListInclude = filterOptions.include.find((include) => include.as === 'userPayoutHistoryList');
138
135
  let where = {};
139
- if (historyListInclude &&
140
- historyListInclude.where &&
141
- historyListInclude.where[sequelize_1.Op.and]) {
136
+ if (historyListInclude && historyListInclude.where && historyListInclude.where[sequelize_1.Op.and]) {
142
137
  where = historyListInclude.where[sequelize_1.Op.and].pop();
143
138
  }
144
139
  if (where.payout_start_time && where.payout_end_time) {
@@ -146,13 +141,10 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
146
141
  endOfPreviousMonth = where.payout_end_time[sequelize_1.Op.lte];
147
142
  }
148
143
  }
149
- const attendanceWhereAnd = [
150
- { date: { $gte: startOfPreviousMonth } },
151
- { date: { $lte: endOfPreviousMonth } },
152
- ];
144
+ const attendanceWhereAnd = [{ date: { $gte: startOfPreviousMonth } }, { date: { $lte: endOfPreviousMonth } }];
153
145
  const exsitUserPayout = (await UserPayoutModel.findOne({
154
146
  where: { id: userPayout.id },
155
- include: [{ association: "userPayoutDetailsList" }],
147
+ include: [{ association: 'userPayoutDetailsList' }],
156
148
  transaction,
157
149
  }));
158
150
  if (!exsitUserPayout)
@@ -162,24 +154,23 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
162
154
  where: {
163
155
  instituteId: exsitUserPayout.instituteId,
164
156
  subjectId: {
165
- [sequelize_1.Op.in]: userPayout.userPayoutDetailsList.map((userPayoutDetails) => userPayoutDetails.subjectId),
157
+ [sequelize_1.Op.in]: userPayout.userPayoutDetailsList.map(userPayoutDetails => userPayoutDetails.subjectId),
166
158
  },
167
159
  },
168
160
  attributes: [
169
- ["subject_id", "subjectId"],
170
- [sequelize_1.Sequelize.fn("sum", sequelize_1.Sequelize.col("amount")), "amount"],
161
+ ['subject_id', 'subjectId'],
162
+ [sequelize_1.Sequelize.fn('sum', sequelize_1.Sequelize.col('amount')), 'amount'],
171
163
  ],
172
- group: ["subject_id", "created_at"],
164
+ group: ['subject_id', 'created_at'],
173
165
  raw: true,
174
166
  });
175
167
  feeTotalBySubjectList = JSON.parse(JSON.stringify(feeTotalBySubjectList));
176
- userPayout.userPayoutDetailsList = userPayout.userPayoutDetailsList.map((oneUserPayoutDetails) => {
168
+ userPayout.userPayoutDetailsList = userPayout.userPayoutDetailsList.map(oneUserPayoutDetails => {
177
169
  oneUserPayoutDetails.payableAmount = feeTotalBySubjectList
178
- .filter((feeTotalBySubject) => feeTotalBySubject.subjectId === oneUserPayoutDetails.subjectId)
170
+ .filter(feeTotalBySubject => feeTotalBySubject.subjectId === oneUserPayoutDetails.subjectId)
179
171
  .reduce((sum, record) => {
180
172
  if (oneUserPayoutDetails.percentage) {
181
- const amount = ((record.amount || 0) * oneUserPayoutDetails.percentage) /
182
- 100;
173
+ const amount = ((record.amount || 0) * oneUserPayoutDetails.percentage) / 100;
183
174
  return sum + parseFloat(amount.toFixed(2)); // Add fixed precision and convert back to number
184
175
  }
185
176
  return sum;
@@ -192,29 +183,25 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
192
183
  where: {
193
184
  instituteId: exsitUserPayout.instituteId,
194
185
  subject: {
195
- [sequelize_1.Op.in]: userPayout.userPayoutDetailsList.map((userPayoutDetails) => userPayoutDetails.subjectId),
186
+ [sequelize_1.Op.in]: userPayout.userPayoutDetailsList.map(userPayoutDetails => userPayoutDetails.subjectId),
196
187
  },
197
- [sequelize_1.Op.or]: [
198
- { primaryUserId: exsitUserPayout.userId },
199
- { secondaryUserId: exsitUserPayout.userId },
200
- ],
188
+ [sequelize_1.Op.or]: [{ primaryUserId: exsitUserPayout.userId }, { secondaryUserId: exsitUserPayout.userId }],
201
189
  },
202
- include: [{ association: "workingDay" }],
190
+ include: [{ association: 'workingDay' }],
203
191
  }));
204
192
  lectureList = JSON.parse(JSON.stringify(lectureList));
205
193
  const currentMonthAttendenceList = await attendanceModel_js_1.default.find({
206
194
  $and: attendanceWhereAnd,
207
195
  userType: userPayout.userType,
208
- "users.userId": userPayout.userId,
209
- "users.status": { $ne: app_js_1.ATTENDANCE_STATUS.ABSENT },
196
+ 'users.userId': userPayout.userId,
197
+ 'users.status': { $ne: app_js_1.ATTENDANCE_STATUS.ABSENT },
210
198
  });
211
- userPayout.userPayoutDetailsList = userPayout.userPayoutDetailsList.map((oneUserPayoutDetails) => {
199
+ userPayout.userPayoutDetailsList = userPayout.userPayoutDetailsList.map(oneUserPayoutDetails => {
212
200
  let totalMinutes = 0;
213
- currentMonthAttendenceList.forEach((attendance) => {
214
- const dayName = (0, date_fns_1.format)(attendance.date, "EEEE");
215
- const attendanceDayLectureBySubjectList = lectureList.filter((lecture) => {
216
- return (lecture.workingDay.dayName === dayName &&
217
- lecture.subject === oneUserPayoutDetails.subjectId);
201
+ currentMonthAttendenceList.forEach(attendance => {
202
+ const dayName = (0, date_fns_1.format)(attendance.date, 'EEEE');
203
+ const attendanceDayLectureBySubjectList = lectureList.filter(lecture => {
204
+ return lecture.workingDay.dayName === dayName && lecture.subject === oneUserPayoutDetails.subjectId;
218
205
  });
219
206
  if (attendanceDayLectureBySubjectList.length) {
220
207
  totalMinutes += attendanceDayLectureBySubjectList.reduce((sum, record) => {
@@ -222,8 +209,7 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
222
209
  }, 0);
223
210
  }
224
211
  });
225
- oneUserPayoutDetails.payableAmount =
226
- ((oneUserPayoutDetails.amountPerHour || 0) / app_js_1.SIXTY) * totalMinutes;
212
+ oneUserPayoutDetails.payableAmount = ((oneUserPayoutDetails.amountPerHour || 0) / app_js_1.SIXTY) * totalMinutes;
227
213
  return oneUserPayoutDetails;
228
214
  });
229
215
  }
@@ -233,9 +219,8 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
233
219
  userPayoutDetails.userId = exsitUserPayout.userId;
234
220
  userPayoutDetails.instituteId = exsitUserPayout.instituteId;
235
221
  userPayoutDetails.type = exsitUserPayout.type;
236
- const found = exsitUserPayout.userPayoutDetailsList.find((exsitUserPayoutDetails) => userPayoutDetails.userPayoutId === exsitUserPayout.id &&
237
- userPayoutDetails.instituteId ===
238
- exsitUserPayoutDetails.instituteId &&
222
+ const found = exsitUserPayout.userPayoutDetailsList.find(exsitUserPayoutDetails => userPayoutDetails.userPayoutId === exsitUserPayout.id &&
223
+ userPayoutDetails.instituteId === exsitUserPayoutDetails.instituteId &&
239
224
  userPayoutDetails.userId === exsitUserPayoutDetails.userId &&
240
225
  userPayoutDetails.type === exsitUserPayoutDetails.type &&
241
226
  userPayoutDetails.subjectId === exsitUserPayoutDetails.subjectId &&
@@ -255,7 +240,7 @@ const afterCreateOrUpdateHook = async (userPayout, user = null, transaction, fil
255
240
  await userPayoutDetailsModel_js_1.default.destroy({
256
241
  where: {
257
242
  id: {
258
- [sequelize_1.Op.notIn]: userPayoutDetailsList.map((userPayoutDetails) => userPayoutDetails.id),
243
+ [sequelize_1.Op.notIn]: userPayoutDetailsList.map(userPayoutDetails => userPayoutDetails.id),
259
244
  },
260
245
  userPayoutId: exsitUserPayout.id,
261
246
  },
@@ -289,7 +274,7 @@ const afterFindHook = async (userPayoutList, options = {}) => {
289
274
  updatedData.push(syncUserPayout);
290
275
  }
291
276
  userPayoutList = userPayoutList.map((userPayout) => {
292
- const found = updatedData.find((one) => one.id === userPayout.id);
277
+ const found = updatedData.find(one => one.id === userPayout.id);
293
278
  if (found) {
294
279
  userPayout.totalPayableAmount = found.totalPayableAmount;
295
280
  userPayout.userPayoutDetailsList = found.userPayoutDetailsList;
@@ -305,7 +290,7 @@ const afterFindHook = async (userPayoutList, options = {}) => {
305
290
  return userPayoutList;
306
291
  }
307
292
  };
308
- UserPayoutModel.addHook("afterFind", async (result, options) => {
293
+ UserPayoutModel.addHook('afterFind', async (result, options) => {
309
294
  if (options.syncUserPayoutLastCalculatedAt && Array.isArray(result)) {
310
295
  result = (await afterFindHook(result, options));
311
296
  }
@@ -1,7 +1,7 @@
1
- import { FilterQuery, UpdateQuery, Document, QueryOptions, Model as MongooseModel, PopulateOptions, MongooseUpdateQueryOptions, UpdateWriteOpResult, ClientSession, CreateOptions } from "mongoose";
2
- import { TPaginationOptions } from "../../types/commonType.js";
3
- import { IMongooseCommonService } from "../Contracts/IMongooseCommonService.js";
4
- import { PipelineStage } from "mongoose";
1
+ import { FilterQuery, UpdateQuery, Document, QueryOptions, Model as MongooseModel, PopulateOptions, MongooseUpdateQueryOptions, UpdateWriteOpResult, ClientSession, CreateOptions } from 'mongoose';
2
+ import { TPaginationOptions } from '../../types/commonType.js';
3
+ import { IMongooseCommonService } from '../Contracts/IMongooseCommonService.js';
4
+ import { PipelineStage } from 'mongoose';
5
5
  export declare class MongooseCommonService<T extends Document> implements IMongooseCommonService<T> {
6
6
  private model;
7
7
  constructor(model: MongooseModel<T>);
@@ -30,7 +30,7 @@ class MongooseCommonService {
30
30
  const convertOrderToSort = (order) => {
31
31
  const sort = {};
32
32
  for (const [key, direction] of order) {
33
- sort[key] = direction.toUpperCase() === "DESC" ? -1 : 1;
33
+ sort[key] = direction.toUpperCase() === 'DESC' ? -1 : 1;
34
34
  }
35
35
  return sort;
36
36
  };
@@ -98,9 +98,7 @@ class MongooseCommonService {
98
98
  }), options);
99
99
  }
100
100
  async delete(filter, options = {}) {
101
- return this.model
102
- .updateMany(filter, { deletedBy: options.userId, deletedAt: new Date() }, options)
103
- .exec();
101
+ return this.model.updateMany(filter, { deletedBy: options.userId, deletedAt: new Date() }, options).exec();
104
102
  }
105
103
  async aggregate(pipeline) {
106
104
  return this.model.aggregate(pipeline).exec();
@@ -1,5 +1,5 @@
1
- import { FilterQuery, UpdateQuery, Document, QueryOptions, PopulateOptions, MongooseUpdateQueryOptions, UpdateWriteOpResult, ClientSession, CreateOptions } from "mongoose";
2
- import { TPaginationOptions } from "../../types/commonType.js";
1
+ import { FilterQuery, UpdateQuery, Document, QueryOptions, PopulateOptions, MongooseUpdateQueryOptions, UpdateWriteOpResult, ClientSession, CreateOptions } from 'mongoose';
2
+ import { TPaginationOptions } from '../../types/commonType.js';
3
3
  interface IReadService<T extends Document> {
4
4
  findAll(filter: FilterQuery<T>, options?: QueryOptions, populate?: PopulateOptions | PopulateOptions[]): Promise<T[]>;
5
5
  findOne(filter: FilterQuery<T>, options?: QueryOptions, populate?: PopulateOptions | PopulateOptions[]): Promise<T | null>;
@@ -1,20 +1,20 @@
1
- import { FindOptions, WhereOptions, UpdateOptions, BulkCreateOptions, DestroyOptions, CreateOptions, Identifier, Model, UpsertOptions, CountOptions } from "sequelize";
2
- import { TPaginationOptions } from "../../types/commonType.js";
1
+ import { FindOptions, WhereOptions, UpdateOptions, BulkCreateOptions, DestroyOptions, CreateOptions, Identifier, Model, UpsertOptions, CountOptions } from 'sequelize';
2
+ import { TPaginationOptions } from '../../types/commonType.js';
3
3
  interface IReadService<T extends Model> {
4
- findAll(where: WhereOptions<T["_attributes"]>, options?: FindOptions<T["_attributes"]>): Promise<T["_attributes"][]>;
5
- findOne(where: WhereOptions<T["_attributes"]>, options?: FindOptions<T["_attributes"]>): Promise<T["_attributes"] | null>;
6
- findByPk(identifier: Identifier, options?: FindOptions<T["_attributes"]>): Promise<T["_attributes"] | null>;
7
- findAllWithPagination(where: WhereOptions<T["_attributes"]>, options?: FindOptions<T["_attributes"]>): Promise<TPaginationOptions<T["_attributes"]>>;
8
- count(where: WhereOptions<T["_attributes"]>, options?: CountOptions<T["_attributes"]>): Promise<number>;
4
+ findAll(where: WhereOptions<T['_attributes']>, options?: FindOptions<T['_attributes']>): Promise<T['_attributes'][]>;
5
+ findOne(where: WhereOptions<T['_attributes']>, options?: FindOptions<T['_attributes']>): Promise<T['_attributes'] | null>;
6
+ findByPk(identifier: Identifier, options?: FindOptions<T['_attributes']>): Promise<T['_attributes'] | null>;
7
+ findAllWithPagination(where: WhereOptions<T['_attributes']>, options?: FindOptions<T['_attributes']>): Promise<TPaginationOptions<T['_attributes']>>;
8
+ count(where: WhereOptions<T['_attributes']>, options?: CountOptions<T['_attributes']>): Promise<number>;
9
9
  }
10
10
  interface IWriteService<T extends Model> {
11
- update(where: WhereOptions<T["_attributes"]>, updateData: Partial<T["_attributes"]>, options?: Partial<UpdateOptions>): Promise<[number]>;
12
- upsert(conflictWhere: WhereOptions<T["_attributes"]>, updateData: T["_creationAttributes"], options?: Partial<UpsertOptions>): Promise<[T["_attributes"], boolean | null]>;
13
- create(createData: T["_creationAttributes"], options?: CreateOptions): Promise<T["_attributes"]>;
14
- bulkCreate(createData: T["_creationAttributes"][], options?: BulkCreateOptions<T["_attributes"]>): Promise<T["_attributes"][]>;
11
+ update(where: WhereOptions<T['_attributes']>, updateData: Partial<T['_attributes']>, options?: Partial<UpdateOptions>): Promise<[number]>;
12
+ upsert(conflictWhere: WhereOptions<T['_attributes']>, updateData: T['_creationAttributes'], options?: Partial<UpsertOptions>): Promise<[T['_attributes'], boolean | null]>;
13
+ create(createData: T['_creationAttributes'], options?: CreateOptions): Promise<T['_attributes']>;
14
+ bulkCreate(createData: T['_creationAttributes'][], options?: BulkCreateOptions<T['_attributes']>): Promise<T['_attributes'][]>;
15
15
  }
16
16
  interface IDeleteService<T extends Model> {
17
- delete(where: WhereOptions<T["_attributes"]>, options?: DestroyOptions<T["_attributes"]>): Promise<number>;
17
+ delete(where: WhereOptions<T['_attributes']>, options?: DestroyOptions<T['_attributes']>): Promise<number>;
18
18
  }
19
19
  export interface ISequelizeCommonService<T extends Model> extends IReadService<T>, IWriteService<T>, IDeleteService<T> {
20
20
  }
@@ -1,2 +1,2 @@
1
- import { IGenarateIdCardModelAttributes } from "../interfaces/generateIdCardInterface.js";
2
- export type TGenarateIdCardModelAttributes = Omit<IGenarateIdCardModelAttributes, "id">;
1
+ import { IGenarateIdCardModelAttributes } from '../interfaces/generateIdCardInterface.js';
2
+ export type TGenarateIdCardModelAttributes = Omit<IGenarateIdCardModelAttributes, 'id'>;
package/package.json CHANGED
@@ -1,49 +1,51 @@
1
1
  {
2
- "name": "@kipicore/dbcore",
3
- "version": "1.1.5",
4
- "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
- "type": "commonjs",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "scripts": {
9
- "clean": "rm -rf dist",
10
- "prebuild": "node scripts/generate-index.js",
11
- "build": "npm run clean && tsc -p tsconfig.json"
12
- },
13
- "keywords": [
14
- "postgres",
15
- "mongodb",
16
- "sequelize",
17
- "mongoose",
18
- "database",
19
- "core",
20
- "typescript"
21
- ],
22
- "author": "chetan godhani",
23
- "license": "MIT",
24
- "private": false,
25
- "dependencies": {
26
- "@aws-sdk/client-s3": "^3.895.0",
27
- "@aws-sdk/s3-request-presigner": "^3.895.0",
28
- "axios": "^1.12.2",
29
- "date-fns": "^4.1.0",
30
- "dotenv": "^17.2.2",
31
- "joi": "^18.0.1",
32
- "mongoose": "^8.5.2",
33
- "pg": "^8.12.0",
34
- "sequelize": "^6.37.3",
35
- "uuid": "^8.3.2"
36
- },
37
- "devDependencies": {
38
- "@types/mongoose": "^5.11.97",
39
- "@types/node": "^24.5.2",
40
- "@types/sequelize": "^4.28.14",
41
- "typescript": "^5.5.4"
42
- },
43
- "files": [
44
- "dist"
45
- ],
46
- "engines": {
47
- "node": ">=20.16.0"
48
- }
2
+ "name": "@kipicore/dbcore",
3
+ "version": "1.1.8",
4
+ "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
+ "type": "commonjs",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "clean": "rm -rf dist",
10
+ "format": "prettier . --write",
11
+ "prebuild": "node scripts/generate-index.js",
12
+ "build": "npm run clean && tsc -p tsconfig.json && npm run format"
13
+ },
14
+ "keywords": [
15
+ "postgres",
16
+ "mongodb",
17
+ "sequelize",
18
+ "mongoose",
19
+ "database",
20
+ "core",
21
+ "typescript"
22
+ ],
23
+ "author": "chetan godhani",
24
+ "license": "MIT",
25
+ "private": false,
26
+ "dependencies": {
27
+ "@aws-sdk/client-s3": "^3.895.0",
28
+ "@aws-sdk/s3-request-presigner": "^3.895.0",
29
+ "axios": "^1.12.2",
30
+ "date-fns": "^4.1.0",
31
+ "dotenv": "^17.2.2",
32
+ "joi": "^18.0.1",
33
+ "mongoose": "^8.5.2",
34
+ "pg": "^8.12.0",
35
+ "sequelize": "^6.37.3",
36
+ "uuid": "^8.3.2"
37
+ },
38
+ "devDependencies": {
39
+ "@types/mongoose": "^5.11.97",
40
+ "@types/node": "^24.5.2",
41
+ "@types/sequelize": "^4.28.14",
42
+ "typescript": "^5.5.4",
43
+ "prettier": "^3.3.3"
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ],
48
+ "engines": {
49
+ "node": ">=20.16.0"
50
+ }
49
51
  }