gemcap-be-common 1.4.100 → 1.4.101

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.100",
3
+ "version": "1.4.101",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -43,7 +43,14 @@ interface IWorkingDaysApi {
43
43
  export declare class CalendarService {
44
44
  private readonly calendarRepository;
45
45
  constructor(calendarRepository: CalendarRepository);
46
- fulfillCalendar(): Promise<void>;
46
+ /**
47
+ * Download a calendar from working days API and save it to DB.
48
+ * It will download all days between startDate and endDate inclusive,
49
+ * for example,
50
+ * startDate as 2025-01-01
51
+ * endDate as 2026-01-01
52
+ */
53
+ fulfillCalendar(startDate: string, endDate: string): Promise<void>;
47
54
  createDate(date: string, dateProp: IWorkingDaysApi): Promise<void>;
48
55
  isWorkingDay(date: string): Promise<boolean>;
49
56
  isLastWorkingDay(date: string): Promise<boolean>;
@@ -12,11 +12,18 @@ class CalendarService {
12
12
  constructor(calendarRepository) {
13
13
  this.calendarRepository = calendarRepository;
14
14
  }
15
- async fulfillCalendar() {
15
+ /**
16
+ * Download a calendar from working days API and save it to DB.
17
+ * It will download all days between startDate and endDate inclusive,
18
+ * for example,
19
+ * startDate as 2025-01-01
20
+ * endDate as 2026-01-01
21
+ */
22
+ async fulfillCalendar(startDate, endDate) {
16
23
  const getDays = () => {
17
24
  const days = [];
18
- const start = (0, dayjs_1.default)('2025-01-01');
19
- const end = (0, dayjs_1.default)('2026-01-01'); // TODO add custom date
25
+ const start = (0, dayjs_1.default)(startDate);
26
+ const end = (0, dayjs_1.default)(endDate);
20
27
  for (let day = (0, dayjs_1.default)(start); day.isBefore(end); day = day.add(1, 'day')) {
21
28
  days.push(day.format('YYYY-MM-DD'));
22
29
  }
@@ -28,12 +28,19 @@ export class CalendarService {
28
28
  ) {
29
29
  }
30
30
 
31
- async fulfillCalendar() {
31
+ /**
32
+ * Download a calendar from working days API and save it to DB.
33
+ * It will download all days between startDate and endDate inclusive,
34
+ * for example,
35
+ * startDate as 2025-01-01
36
+ * endDate as 2026-01-01
37
+ */
38
+ async fulfillCalendar(startDate: string, endDate: string) {
32
39
 
33
40
  const getDays = () => {
34
41
  const days: string[] = [];
35
- const start = dayjs('2025-01-01');
36
- const end = dayjs('2026-01-01'); // TODO add custom date
42
+ const start = dayjs(startDate);
43
+ const end = dayjs(endDate);
37
44
  for (let day = dayjs(start); day.isBefore(end); day = day.add(1, 'day')) {
38
45
  days.push(day.format('YYYY-MM-DD'));
39
46
  }
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
155
155
  getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
156
156
  transactionIdsToMark: any[];
157
157
  transactions: {
158
- [x: string]: (string | number | Date | string[])[];
158
+ [x: string]: (string | number | string[] | Date)[];
159
159
  }[];
160
160
  }>;
161
161
  getBorrowerIdsForFile(transactionFileId: string): Promise<{