@mody-park-cha-raja/finance_common 4.20.0 → 4.20.1-beta.3

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/dist/index.d.mts CHANGED
@@ -70,6 +70,11 @@ declare enum VendorType {
70
70
  OTHER = "Other"
71
71
  }
72
72
 
73
+ declare const PAYMENT_OPTIONS: readonly {
74
+ value: PaymentType;
75
+ label: string;
76
+ }[];
77
+
73
78
  interface IAuditColumnEntity {
74
79
  createdOn: number;
75
80
  updatedOn: number;
@@ -114,9 +119,10 @@ interface IExpenseEntity extends IAuditColumnEntity {
114
119
  name: string;
115
120
  type: ExpenseType;
116
121
  incurredBy: number;
117
- vendorName: string;
122
+ vendorId: number;
118
123
  billNumber?: string;
119
124
  remarks?: string;
125
+ description?: string;
120
126
  amount: number;
121
127
  paymentType: PaymentType;
122
128
  status?: EntityStatus;
@@ -223,6 +229,13 @@ interface IVendorEntity extends IAuditColumnEntity {
223
229
  name: string;
224
230
  type: string;
225
231
  }
232
+ /**
233
+ * Common config for vendor entity
234
+ * used on the expense entity as a vendorId -> vendor relation
235
+ *
236
+ * Adding column keys reduce the bandwidth that is used
237
+ */
238
+ declare const VENDOR_RELATION_CONFIG: IEntityFilterSearchData<EntityList.VENDOR>;
226
239
 
227
240
  declare class DonationHistoryModel extends BaseEntityModel implements IDonationHistoryEntity {
228
241
  id: number;
@@ -293,15 +306,31 @@ declare class ExpenseHistoryModel extends BaseEntityModel implements IExpenseHis
293
306
  static populateFromEntity(entity: IExpenseHistoryEntity): ExpenseHistoryModel;
294
307
  }
295
308
 
309
+ declare class VendorModel extends BaseEntityModel implements IVendorEntity {
310
+ id: number;
311
+ name: string;
312
+ type: string;
313
+ createdOn: number;
314
+ updatedOn: number;
315
+ createdBy: number;
316
+ updatedBy: number;
317
+ createdByUser?: UserModel;
318
+ updatedByUser?: UserModel;
319
+ protected constructor();
320
+ static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
321
+ static populateFromEntity(entity: IVendorEntity): VendorModel;
322
+ }
323
+
296
324
  declare class ExpenseModel extends BaseEntityModel implements IExpenseEntity {
297
325
  id: number;
298
326
  name: string;
299
327
  type: ExpenseType;
300
- vendorName: string;
328
+ vendorId: number;
301
329
  incurredBy: number;
302
330
  amount: number;
303
331
  billNumber?: string;
304
332
  remarks?: string;
333
+ description?: string;
305
334
  paymentType: PaymentType;
306
335
  status: EntityStatus;
307
336
  createdOn: number;
@@ -311,10 +340,12 @@ declare class ExpenseModel extends BaseEntityModel implements IExpenseEntity {
311
340
  createdByUser?: UserModel;
312
341
  updatedByUser?: UserModel;
313
342
  incurredByUser?: UserModel;
343
+ vendor?: VendorModel;
314
344
  protected constructor();
315
345
  static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
316
346
  static populateFromEntity(entity: IExpenseEntity): ExpenseModel;
317
347
  get incurredByUserName(): string | undefined;
348
+ get vendorName(): string;
318
349
  }
319
350
 
320
351
  interface FlatDonationLike {
@@ -462,21 +493,6 @@ declare class VendorHistoryModel extends BaseEntityModel implements IVendorHisto
462
493
  static populateFromEntity(entity: IVendorHistoryEntity): VendorHistoryModel;
463
494
  }
464
495
 
465
- declare class VendorModel extends BaseEntityModel implements IVendorEntity {
466
- id: number;
467
- name: string;
468
- type: string;
469
- createdOn: number;
470
- updatedOn: number;
471
- createdBy: number;
472
- updatedBy: number;
473
- createdByUser?: UserModel;
474
- updatedByUser?: UserModel;
475
- protected constructor();
476
- static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
477
- static populateFromEntity(entity: IVendorEntity): VendorModel;
478
- }
479
-
480
496
  declare class ConfigurationModel extends BaseEntityModel implements IConfigurationEntity {
481
497
  id: number;
482
498
  key: string;
@@ -788,4 +804,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
788
804
  interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
789
805
  }
790
806
 
791
- export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
807
+ export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VENDOR_RELATION_CONFIG, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
package/dist/index.d.ts CHANGED
@@ -70,6 +70,11 @@ declare enum VendorType {
70
70
  OTHER = "Other"
71
71
  }
72
72
 
73
+ declare const PAYMENT_OPTIONS: readonly {
74
+ value: PaymentType;
75
+ label: string;
76
+ }[];
77
+
73
78
  interface IAuditColumnEntity {
74
79
  createdOn: number;
75
80
  updatedOn: number;
@@ -114,9 +119,10 @@ interface IExpenseEntity extends IAuditColumnEntity {
114
119
  name: string;
115
120
  type: ExpenseType;
116
121
  incurredBy: number;
117
- vendorName: string;
122
+ vendorId: number;
118
123
  billNumber?: string;
119
124
  remarks?: string;
125
+ description?: string;
120
126
  amount: number;
121
127
  paymentType: PaymentType;
122
128
  status?: EntityStatus;
@@ -223,6 +229,13 @@ interface IVendorEntity extends IAuditColumnEntity {
223
229
  name: string;
224
230
  type: string;
225
231
  }
232
+ /**
233
+ * Common config for vendor entity
234
+ * used on the expense entity as a vendorId -> vendor relation
235
+ *
236
+ * Adding column keys reduce the bandwidth that is used
237
+ */
238
+ declare const VENDOR_RELATION_CONFIG: IEntityFilterSearchData<EntityList.VENDOR>;
226
239
 
227
240
  declare class DonationHistoryModel extends BaseEntityModel implements IDonationHistoryEntity {
228
241
  id: number;
@@ -293,15 +306,31 @@ declare class ExpenseHistoryModel extends BaseEntityModel implements IExpenseHis
293
306
  static populateFromEntity(entity: IExpenseHistoryEntity): ExpenseHistoryModel;
294
307
  }
295
308
 
309
+ declare class VendorModel extends BaseEntityModel implements IVendorEntity {
310
+ id: number;
311
+ name: string;
312
+ type: string;
313
+ createdOn: number;
314
+ updatedOn: number;
315
+ createdBy: number;
316
+ updatedBy: number;
317
+ createdByUser?: UserModel;
318
+ updatedByUser?: UserModel;
319
+ protected constructor();
320
+ static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
321
+ static populateFromEntity(entity: IVendorEntity): VendorModel;
322
+ }
323
+
296
324
  declare class ExpenseModel extends BaseEntityModel implements IExpenseEntity {
297
325
  id: number;
298
326
  name: string;
299
327
  type: ExpenseType;
300
- vendorName: string;
328
+ vendorId: number;
301
329
  incurredBy: number;
302
330
  amount: number;
303
331
  billNumber?: string;
304
332
  remarks?: string;
333
+ description?: string;
305
334
  paymentType: PaymentType;
306
335
  status: EntityStatus;
307
336
  createdOn: number;
@@ -311,10 +340,12 @@ declare class ExpenseModel extends BaseEntityModel implements IExpenseEntity {
311
340
  createdByUser?: UserModel;
312
341
  updatedByUser?: UserModel;
313
342
  incurredByUser?: UserModel;
343
+ vendor?: VendorModel;
314
344
  protected constructor();
315
345
  static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
316
346
  static populateFromEntity(entity: IExpenseEntity): ExpenseModel;
317
347
  get incurredByUserName(): string | undefined;
348
+ get vendorName(): string;
318
349
  }
319
350
 
320
351
  interface FlatDonationLike {
@@ -462,21 +493,6 @@ declare class VendorHistoryModel extends BaseEntityModel implements IVendorHisto
462
493
  static populateFromEntity(entity: IVendorHistoryEntity): VendorHistoryModel;
463
494
  }
464
495
 
465
- declare class VendorModel extends BaseEntityModel implements IVendorEntity {
466
- id: number;
467
- name: string;
468
- type: string;
469
- createdOn: number;
470
- updatedOn: number;
471
- createdBy: number;
472
- updatedBy: number;
473
- createdByUser?: UserModel;
474
- updatedByUser?: UserModel;
475
- protected constructor();
476
- static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
477
- static populateFromEntity(entity: IVendorEntity): VendorModel;
478
- }
479
-
480
496
  declare class ConfigurationModel extends BaseEntityModel implements IConfigurationEntity {
481
497
  id: number;
482
498
  key: string;
@@ -788,4 +804,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
788
804
  interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
789
805
  }
790
806
 
791
- export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
807
+ export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VENDOR_RELATION_CONFIG, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  HttpException: () => HttpException,
44
44
  NotFoundException: () => NotFoundException,
45
45
  OrderByDirection: () => OrderByDirection,
46
+ PAYMENT_OPTIONS: () => PAYMENT_OPTIONS,
46
47
  PaymentType: () => PaymentType,
47
48
  ReferenceIdPrefix: () => ReferenceIdPrefix,
48
49
  RelationType: () => RelationType,
@@ -57,6 +58,7 @@ __export(index_exports, {
57
58
  UnauthorizedException: () => UnauthorizedException,
58
59
  UserHistoryModel: () => UserHistoryModel,
59
60
  UserModel: () => UserModel,
61
+ VENDOR_RELATION_CONFIG: () => VENDOR_RELATION_CONFIG,
60
62
  VendorHistoryModel: () => VendorHistoryModel,
61
63
  VendorModel: () => VendorModel,
62
64
  VendorType: () => VendorType,
@@ -490,6 +492,13 @@ var VendorType = /* @__PURE__ */ ((VendorType2) => {
490
492
  return VendorType2;
491
493
  })(VendorType || {});
492
494
 
495
+ // src/data/payment-options.ts
496
+ var PAYMENT_OPTIONS = [
497
+ { value: "Cash" /* CASH */, label: "Cash" },
498
+ { value: "UPI" /* UPI */, label: "UPI" },
499
+ { value: "Bank Transfer" /* BANK_TRANSFER */, label: "Bank Transfer" }
500
+ ];
501
+
493
502
  // src/utils/date-code.utils.ts
494
503
  var DateCodeUtils = class _DateCodeUtils {
495
504
  constructor(dateCode) {
@@ -812,7 +821,7 @@ var _ExpenseModel = class _ExpenseModel extends BaseEntityModel {
812
821
  this.id = 0;
813
822
  this.name = "";
814
823
  this.type = "Miscellaneous" /* MISCELLANEOUS */;
815
- this.vendorName = "";
824
+ this.vendorId = 0;
816
825
  this.incurredBy = 0;
817
826
  this.amount = 0;
818
827
  this.paymentType = "Cash" /* CASH */;
@@ -830,6 +839,9 @@ var _ExpenseModel = class _ExpenseModel extends BaseEntityModel {
830
839
  get incurredByUserName() {
831
840
  return this.incurredByUser?.name;
832
841
  }
842
+ get vendorName() {
843
+ return this.vendor?.name ?? "";
844
+ }
833
845
  };
834
846
  _ExpenseModel.relations = {
835
847
  ["user" /* USER */]: {
@@ -841,6 +853,14 @@ _ExpenseModel.relations = {
841
853
  ],
842
854
  searchProperty: "id",
843
855
  entity: "user" /* USER */
856
+ },
857
+ ["vendor" /* VENDOR */]: {
858
+ relationType: "ONE" /* ONE */,
859
+ mappingProperties: [
860
+ { sourceProperty: "vendorId", targetProperty: "vendor" }
861
+ ],
862
+ searchProperty: "id",
863
+ entity: "vendor" /* VENDOR */
844
864
  }
845
865
  };
846
866
  var ExpenseModel = _ExpenseModel;
@@ -1563,6 +1583,12 @@ var USER_RELATION_CONFIG = {
1563
1583
  name: "user" /* USER */,
1564
1584
  columnKeys: ["id", "name"]
1565
1585
  };
1586
+
1587
+ // src/interfaces/entities/vendor.entity.interface.ts
1588
+ var VENDOR_RELATION_CONFIG = {
1589
+ name: "vendor" /* VENDOR */,
1590
+ columnKeys: ["id", "name"]
1591
+ };
1566
1592
  // Annotate the CommonJS export names for ESM import in node:
1567
1593
  0 && (module.exports = {
1568
1594
  BadRequestException,
@@ -1588,6 +1614,7 @@ var USER_RELATION_CONFIG = {
1588
1614
  HttpException,
1589
1615
  NotFoundException,
1590
1616
  OrderByDirection,
1617
+ PAYMENT_OPTIONS,
1591
1618
  PaymentType,
1592
1619
  ReferenceIdPrefix,
1593
1620
  RelationType,
@@ -1602,6 +1629,7 @@ var USER_RELATION_CONFIG = {
1602
1629
  UnauthorizedException,
1603
1630
  UserHistoryModel,
1604
1631
  UserModel,
1632
+ VENDOR_RELATION_CONFIG,
1605
1633
  VendorHistoryModel,
1606
1634
  VendorModel,
1607
1635
  VendorType,