@mody-park-cha-raja/finance_common 4.29.0 → 4.29.1-beta.0

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/README.md CHANGED
@@ -1,18 +1,18 @@
1
- # Name
2
- ### @mody-park-cha-raja/finance_common
3
-
4
- # Synopsis
5
- Common interfaces, models, enums, and utilities for the Mody Park Cha Raja finance ecosystem
6
-
7
- # Description
8
-
9
- # Example
10
-
11
- # Install:
12
- `npm install @mody-park-cha-raja/finance_common`
13
-
14
- # Test:
15
- `npm test`
16
-
17
- #License:
18
- ISC
1
+ # Name
2
+ ### @mody-park-cha-raja/finance_common
3
+
4
+ # Synopsis
5
+ Common interfaces, models, enums, and utilities for the Mody Park Cha Raja finance ecosystem
6
+
7
+ # Description
8
+
9
+ # Example
10
+
11
+ # Install:
12
+ `npm install @mody-park-cha-raja/finance_common`
13
+
14
+ # Test:
15
+ `npm test`
16
+
17
+ #License:
18
+ ISC
package/dist/index.d.mts CHANGED
@@ -113,6 +113,7 @@ interface IDonationEntity extends IAuditColumnEntity {
113
113
  receiptNumber: string;
114
114
  flatNo: string;
115
115
  name?: string;
116
+ flatId: number;
116
117
  amount: number;
117
118
  mobileNumber?: string;
118
119
  paymentType: PaymentType;
@@ -292,11 +293,70 @@ declare class UserModel extends BaseEntityModel implements IUserEntity {
292
293
  static populateFromEntity(entity: IUserEntity): UserModel;
293
294
  }
294
295
 
296
+ interface FlatDonationLike {
297
+ flatNo: string;
298
+ amount: number;
299
+ donationYear?: number;
300
+ createdOn?: number;
301
+ createdByUser?: Nullable<{
302
+ name?: string;
303
+ }>;
304
+ updatedByUser?: Nullable<{
305
+ name?: string;
306
+ }>;
307
+ }
308
+ type FlatCollectionStatus = "Paid" | "Pending";
309
+ interface FlatCollectionEntry {
310
+ flatNumber: string;
311
+ status: FlatCollectionStatus;
312
+ amount: number;
313
+ latestDonation?: Nullable<FlatDonationLike>;
314
+ }
315
+ interface FlatParseResult {
316
+ wing?: string;
317
+ num?: string;
318
+ isSpecial: boolean;
319
+ }
320
+ interface FlatOption {
321
+ label: string;
322
+ value: string;
323
+ }
324
+ declare class FlatModel {
325
+ id: number;
326
+ wing: string;
327
+ unitNumber: string;
328
+ status: EntityStatus;
329
+ createdOn: number;
330
+ updatedOn: number;
331
+ createdBy: number;
332
+ updatedBy: number;
333
+ static populateFromEntity(entity: IFlatEntity): FlatModel;
334
+ createdByUser?: UserModel;
335
+ updatedByUser?: UserModel;
336
+ donations?: DonationModel[];
337
+ static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
338
+ static readonly FLAT_NUMBERS: readonly string[];
339
+ static readonly FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
340
+ static readonly SPECIAL_FLATS: readonly string[];
341
+ static readonly WINGS: readonly string[];
342
+ static getDonationYear(): number;
343
+ static getTotalFlats(): number;
344
+ static buildFlatNumber(wing: string, num: string): string;
345
+ static isSpecialFlat(flatNo: string): boolean;
346
+ static parseFlatNumber(flatNo: string): FlatParseResult;
347
+ static getFlatOptions(wing: string): FlatOption[];
348
+ static getDisplayLabel(wing: string, flatNo: string): string;
349
+ static computeCollectionStatus(donations: FlatDonationLike[], year: number): FlatCollectionEntry[];
350
+ static compareFlatNumbers(a: string, b: string): number;
351
+ static convertNumberToWords(num: number): string;
352
+ }
353
+
295
354
  declare class DonationModel extends BaseEntityModel implements IDonationEntity {
296
355
  id: number;
297
356
  receiptNumber: string;
298
357
  flatNo: string;
299
358
  name?: string;
359
+ flatId: number;
300
360
  amount: number;
301
361
  mobileNumber?: string;
302
362
  paymentType: PaymentType;
@@ -308,6 +368,7 @@ declare class DonationModel extends BaseEntityModel implements IDonationEntity {
308
368
  updatedBy: number;
309
369
  createdByUser?: UserModel;
310
370
  updatedByUser?: UserModel;
371
+ flat?: FlatModel;
311
372
  protected constructor();
312
373
  static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
313
374
  static populateFromEntity(entity: IDonationEntity): DonationModel;
@@ -432,60 +493,6 @@ declare class FlatHistoryModel extends BaseEntityModel implements IFlatHistoryEn
432
493
  static populateFromEntity(entity: IFlatHistoryEntity): FlatHistoryModel;
433
494
  }
434
495
 
435
- interface FlatDonationLike {
436
- flatNo: string;
437
- amount: number;
438
- donationYear?: number;
439
- createdOn?: number;
440
- createdByUser?: Nullable<{
441
- name?: string;
442
- }>;
443
- updatedByUser?: Nullable<{
444
- name?: string;
445
- }>;
446
- }
447
- type FlatCollectionStatus = "Paid" | "Pending";
448
- interface FlatCollectionEntry {
449
- flatNumber: string;
450
- status: FlatCollectionStatus;
451
- amount: number;
452
- latestDonation?: Nullable<FlatDonationLike>;
453
- }
454
- interface FlatParseResult {
455
- wing?: string;
456
- num?: string;
457
- isSpecial: boolean;
458
- }
459
- interface FlatOption {
460
- label: string;
461
- value: string;
462
- }
463
- declare class FlatModel {
464
- id: number;
465
- wing: string;
466
- unitNumber: string;
467
- status: EntityStatus;
468
- createdOn: number;
469
- updatedOn: number;
470
- createdBy: number;
471
- updatedBy: number;
472
- static populateFromEntity(entity: IFlatEntity): FlatModel;
473
- static readonly FLAT_NUMBERS: readonly string[];
474
- static readonly FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
475
- static readonly SPECIAL_FLATS: readonly string[];
476
- static readonly WINGS: readonly string[];
477
- static getDonationYear(): number;
478
- static getTotalFlats(): number;
479
- static buildFlatNumber(wing: string, num: string): string;
480
- static isSpecialFlat(flatNo: string): boolean;
481
- static parseFlatNumber(flatNo: string): FlatParseResult;
482
- static getFlatOptions(wing: string): FlatOption[];
483
- static getDisplayLabel(wing: string, flatNo: string): string;
484
- static computeCollectionStatus(donations: FlatDonationLike[], year: number): FlatCollectionEntry[];
485
- static compareFlatNumbers(a: string, b: string): number;
486
- static convertNumberToWords(num: number): string;
487
- }
488
-
489
496
  declare class SponsorHistoryModel extends BaseEntityModel implements ISponsorHistoryEntity {
490
497
  id: number;
491
498
  entityId: number;
package/dist/index.d.ts CHANGED
@@ -113,6 +113,7 @@ interface IDonationEntity extends IAuditColumnEntity {
113
113
  receiptNumber: string;
114
114
  flatNo: string;
115
115
  name?: string;
116
+ flatId: number;
116
117
  amount: number;
117
118
  mobileNumber?: string;
118
119
  paymentType: PaymentType;
@@ -292,11 +293,70 @@ declare class UserModel extends BaseEntityModel implements IUserEntity {
292
293
  static populateFromEntity(entity: IUserEntity): UserModel;
293
294
  }
294
295
 
296
+ interface FlatDonationLike {
297
+ flatNo: string;
298
+ amount: number;
299
+ donationYear?: number;
300
+ createdOn?: number;
301
+ createdByUser?: Nullable<{
302
+ name?: string;
303
+ }>;
304
+ updatedByUser?: Nullable<{
305
+ name?: string;
306
+ }>;
307
+ }
308
+ type FlatCollectionStatus = "Paid" | "Pending";
309
+ interface FlatCollectionEntry {
310
+ flatNumber: string;
311
+ status: FlatCollectionStatus;
312
+ amount: number;
313
+ latestDonation?: Nullable<FlatDonationLike>;
314
+ }
315
+ interface FlatParseResult {
316
+ wing?: string;
317
+ num?: string;
318
+ isSpecial: boolean;
319
+ }
320
+ interface FlatOption {
321
+ label: string;
322
+ value: string;
323
+ }
324
+ declare class FlatModel {
325
+ id: number;
326
+ wing: string;
327
+ unitNumber: string;
328
+ status: EntityStatus;
329
+ createdOn: number;
330
+ updatedOn: number;
331
+ createdBy: number;
332
+ updatedBy: number;
333
+ static populateFromEntity(entity: IFlatEntity): FlatModel;
334
+ createdByUser?: UserModel;
335
+ updatedByUser?: UserModel;
336
+ donations?: DonationModel[];
337
+ static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
338
+ static readonly FLAT_NUMBERS: readonly string[];
339
+ static readonly FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
340
+ static readonly SPECIAL_FLATS: readonly string[];
341
+ static readonly WINGS: readonly string[];
342
+ static getDonationYear(): number;
343
+ static getTotalFlats(): number;
344
+ static buildFlatNumber(wing: string, num: string): string;
345
+ static isSpecialFlat(flatNo: string): boolean;
346
+ static parseFlatNumber(flatNo: string): FlatParseResult;
347
+ static getFlatOptions(wing: string): FlatOption[];
348
+ static getDisplayLabel(wing: string, flatNo: string): string;
349
+ static computeCollectionStatus(donations: FlatDonationLike[], year: number): FlatCollectionEntry[];
350
+ static compareFlatNumbers(a: string, b: string): number;
351
+ static convertNumberToWords(num: number): string;
352
+ }
353
+
295
354
  declare class DonationModel extends BaseEntityModel implements IDonationEntity {
296
355
  id: number;
297
356
  receiptNumber: string;
298
357
  flatNo: string;
299
358
  name?: string;
359
+ flatId: number;
300
360
  amount: number;
301
361
  mobileNumber?: string;
302
362
  paymentType: PaymentType;
@@ -308,6 +368,7 @@ declare class DonationModel extends BaseEntityModel implements IDonationEntity {
308
368
  updatedBy: number;
309
369
  createdByUser?: UserModel;
310
370
  updatedByUser?: UserModel;
371
+ flat?: FlatModel;
311
372
  protected constructor();
312
373
  static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
313
374
  static populateFromEntity(entity: IDonationEntity): DonationModel;
@@ -432,60 +493,6 @@ declare class FlatHistoryModel extends BaseEntityModel implements IFlatHistoryEn
432
493
  static populateFromEntity(entity: IFlatHistoryEntity): FlatHistoryModel;
433
494
  }
434
495
 
435
- interface FlatDonationLike {
436
- flatNo: string;
437
- amount: number;
438
- donationYear?: number;
439
- createdOn?: number;
440
- createdByUser?: Nullable<{
441
- name?: string;
442
- }>;
443
- updatedByUser?: Nullable<{
444
- name?: string;
445
- }>;
446
- }
447
- type FlatCollectionStatus = "Paid" | "Pending";
448
- interface FlatCollectionEntry {
449
- flatNumber: string;
450
- status: FlatCollectionStatus;
451
- amount: number;
452
- latestDonation?: Nullable<FlatDonationLike>;
453
- }
454
- interface FlatParseResult {
455
- wing?: string;
456
- num?: string;
457
- isSpecial: boolean;
458
- }
459
- interface FlatOption {
460
- label: string;
461
- value: string;
462
- }
463
- declare class FlatModel {
464
- id: number;
465
- wing: string;
466
- unitNumber: string;
467
- status: EntityStatus;
468
- createdOn: number;
469
- updatedOn: number;
470
- createdBy: number;
471
- updatedBy: number;
472
- static populateFromEntity(entity: IFlatEntity): FlatModel;
473
- static readonly FLAT_NUMBERS: readonly string[];
474
- static readonly FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
475
- static readonly SPECIAL_FLATS: readonly string[];
476
- static readonly WINGS: readonly string[];
477
- static getDonationYear(): number;
478
- static getTotalFlats(): number;
479
- static buildFlatNumber(wing: string, num: string): string;
480
- static isSpecialFlat(flatNo: string): boolean;
481
- static parseFlatNumber(flatNo: string): FlatParseResult;
482
- static getFlatOptions(wing: string): FlatOption[];
483
- static getDisplayLabel(wing: string, flatNo: string): string;
484
- static computeCollectionStatus(donations: FlatDonationLike[], year: number): FlatCollectionEntry[];
485
- static compareFlatNumbers(a: string, b: string): number;
486
- static convertNumberToWords(num: number): string;
487
- }
488
-
489
496
  declare class SponsorHistoryModel extends BaseEntityModel implements ISponsorHistoryEntity {
490
497
  id: number;
491
498
  entityId: number;
package/dist/index.js CHANGED
@@ -778,6 +778,7 @@ var _DonationModel = class _DonationModel extends BaseEntityModel {
778
778
  this.id = 0;
779
779
  this.receiptNumber = "";
780
780
  this.flatNo = "";
781
+ this.flatId = 0;
781
782
  this.amount = 0;
782
783
  this.paymentType = "Cash" /* CASH */;
783
784
  this.status = "Active" /* ACTIVE */;
@@ -835,6 +836,12 @@ _DonationModel.relations = {
835
836
  ],
836
837
  searchProperty: "id",
837
838
  entity: "user" /* USER */
839
+ },
840
+ ["flat" /* FLAT */]: {
841
+ relationType: "ONE" /* ONE */,
842
+ mappingProperties: [{ sourceProperty: "flatId", targetProperty: "flat" }],
843
+ searchProperty: "id",
844
+ entity: "flat" /* FLAT */
838
845
  }
839
846
  };
840
847
  var DonationModel = _DonationModel;
@@ -1180,6 +1187,25 @@ var _FlatModel = class _FlatModel {
1180
1187
  return convertNumberToWords(num);
1181
1188
  }
1182
1189
  };
1190
+ _FlatModel.relations = {
1191
+ ["user" /* USER */]: {
1192
+ relationType: "ONE" /* ONE */,
1193
+ mappingProperties: [
1194
+ { sourceProperty: "createdBy", targetProperty: "createdByUser" },
1195
+ { sourceProperty: "updatedBy", targetProperty: "updatedByUser" }
1196
+ ],
1197
+ searchProperty: "id",
1198
+ entity: "user" /* USER */
1199
+ },
1200
+ ["donation" /* DONATION */]: {
1201
+ relationType: "MANY" /* MANY */,
1202
+ mappingProperties: [
1203
+ { sourceProperty: "id", targetProperty: "donations" }
1204
+ ],
1205
+ searchProperty: "flatId",
1206
+ entity: "donation" /* DONATION */
1207
+ }
1208
+ };
1183
1209
  _FlatModel.FLAT_NUMBERS = FLAT_NUMBERS;
1184
1210
  _FlatModel.FLATS_BY_WING = FLATS_BY_WING;
1185
1211
  _FlatModel.SPECIAL_FLATS = SPECIAL_FLATS;