@kipicore/dbcore 1.1.300 → 1.1.302

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.
@@ -64,6 +64,7 @@ export interface ILastSchoolSchema {
64
64
  result?: number;
65
65
  haveLeavingCertificate?: boolean;
66
66
  entities: string[];
67
+ leavingCertificateIssueDate: Date;
67
68
  isSchool?: boolean;
68
69
  }
69
70
  export interface IAddressSchema {
@@ -257,24 +257,28 @@ const createOrUpdateHook = async (examGroup) => {
257
257
  // }
258
258
  }
259
259
  //*********** days array remove duplicate date from date if multiple date empty ********///
260
- examGroup.standardByDays = examGroup.standardByDays.map(standard => ({
261
- ...standard,
262
- days: standard.days.reduce((acc, day) => {
263
- const existingIndex = acc.findIndex(d => new Date(d.date).getTime() === new Date(day.date).getTime());
264
- if (Object.keys(day.examDetails || {}).length > 0) {
265
- // If an empty object exists for this date, remove it
266
- if (existingIndex !== -1 && Object.keys(acc[existingIndex].examDetails || {}).length === 0) {
267
- acc.splice(existingIndex, 1);
260
+ const dateListTimestamp = dateList.map(date => new Date(date).getTime());
261
+ examGroup.standardByDays = examGroup.standardByDays.map(standard => {
262
+ standard.days = standard.days.filter(day => dateListTimestamp.includes(new Date(day.date).getTime()));
263
+ return {
264
+ ...standard,
265
+ days: standard.days.reduce((acc, day) => {
266
+ const existingIndex = acc.findIndex(d => new Date(d.date).getTime() === new Date(day.date).getTime());
267
+ if (Object.keys(day.examDetails || {}).length > 0) {
268
+ // If an empty object exists for this date, remove it
269
+ if (existingIndex !== -1 && Object.keys(acc[existingIndex].examDetails || {}).length === 0) {
270
+ acc.splice(existingIndex, 1);
271
+ }
272
+ acc.push(day);
268
273
  }
269
- acc.push(day);
270
- }
271
- else if (existingIndex === -1) {
272
- // Push empty examDetails object only if there's no existing entry
273
- acc.push(day);
274
- }
275
- return acc;
276
- }, []),
277
- }));
274
+ else if (existingIndex === -1) {
275
+ // Push empty examDetails object only if there's no existing entry
276
+ acc.push(day);
277
+ }
278
+ return acc;
279
+ }, []),
280
+ };
281
+ });
278
282
  }
279
283
  }
280
284
  catch (err) {
@@ -268,6 +268,10 @@ const LastSchoolSchema = new mongoose_1.Schema({
268
268
  type: Boolean,
269
269
  required: false,
270
270
  },
271
+ leavingCertificateIssueDate: {
272
+ type: Date,
273
+ required: false,
274
+ }
271
275
  }, { _id: false });
272
276
  const AddressSchema = new mongoose_1.Schema({
273
277
  pinCode: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.300",
3
+ "version": "1.1.302",
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",