@mody-park-cha-raja/finance_common 4.21.0 → 4.24.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/dist/index.d.mts +27 -17
- package/dist/index.d.ts +27 -17
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -58,6 +58,13 @@ declare enum SponsorTier {
|
|
|
58
58
|
GENERAL_SPONSOR = "General Sponsor"
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
declare enum TransactionEntityType {
|
|
62
|
+
DONATION = "donation",
|
|
63
|
+
SPONSOR = "sponsor",
|
|
64
|
+
EXPENSE = "expense",
|
|
65
|
+
DAAN_PETI = "daan_peti"
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
declare enum TransactionType {
|
|
62
69
|
INCOME = "Income",
|
|
63
70
|
EXPENSE = "Expense"
|
|
@@ -146,6 +153,13 @@ interface ISponsorEntity extends IAuditColumnEntity {
|
|
|
146
153
|
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
interface IDtoValidationError {
|
|
157
|
+
key: string;
|
|
158
|
+
message: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
type Nullable<T> = T | null;
|
|
162
|
+
|
|
149
163
|
interface ITransactionEntity extends IAuditColumnEntity {
|
|
150
164
|
id: number;
|
|
151
165
|
date: string;
|
|
@@ -153,7 +167,8 @@ interface ITransactionEntity extends IAuditColumnEntity {
|
|
|
153
167
|
particulars: string;
|
|
154
168
|
amount: number;
|
|
155
169
|
balanceAfter: number;
|
|
156
|
-
referenceId:
|
|
170
|
+
referenceId: Nullable<number>;
|
|
171
|
+
entityType?: Nullable<TransactionEntityType>;
|
|
157
172
|
paymentType: PaymentType;
|
|
158
173
|
status?: EntityStatus;
|
|
159
174
|
}
|
|
@@ -161,13 +176,6 @@ interface ITransactionEntity extends IAuditColumnEntity {
|
|
|
161
176
|
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
162
177
|
}
|
|
163
178
|
|
|
164
|
-
interface IDtoValidationError {
|
|
165
|
-
key: string;
|
|
166
|
-
message: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type Nullable<T> = T | null;
|
|
170
|
-
|
|
171
179
|
/**
|
|
172
180
|
* Utility class for validating date codes in `YYYYMMDD` format.
|
|
173
181
|
*
|
|
@@ -346,19 +354,19 @@ interface FlatDonationLike {
|
|
|
346
354
|
amount: number;
|
|
347
355
|
donationYear?: number;
|
|
348
356
|
createdOn?: number;
|
|
349
|
-
createdByUser?: {
|
|
357
|
+
createdByUser?: Nullable<{
|
|
350
358
|
name?: string;
|
|
351
|
-
}
|
|
352
|
-
updatedByUser?: {
|
|
359
|
+
}>;
|
|
360
|
+
updatedByUser?: Nullable<{
|
|
353
361
|
name?: string;
|
|
354
|
-
}
|
|
362
|
+
}>;
|
|
355
363
|
}
|
|
356
364
|
type FlatCollectionStatus = "Paid" | "Pending";
|
|
357
365
|
interface FlatCollectionEntry {
|
|
358
366
|
flatNumber: string;
|
|
359
367
|
status: FlatCollectionStatus;
|
|
360
368
|
amount: number;
|
|
361
|
-
latestDonation?: FlatDonationLike
|
|
369
|
+
latestDonation?: Nullable<FlatDonationLike>;
|
|
362
370
|
}
|
|
363
371
|
interface FlatParseResult {
|
|
364
372
|
wing?: string;
|
|
@@ -442,7 +450,8 @@ declare class TransactionModel extends BaseEntityModel implements ITransactionEn
|
|
|
442
450
|
particulars: string;
|
|
443
451
|
amount: number;
|
|
444
452
|
balanceAfter: number;
|
|
445
|
-
referenceId:
|
|
453
|
+
referenceId: Nullable<number>;
|
|
454
|
+
entityType: Nullable<TransactionEntityType>;
|
|
446
455
|
paymentType: PaymentType;
|
|
447
456
|
status: EntityStatus;
|
|
448
457
|
createdOn: number;
|
|
@@ -454,6 +463,7 @@ declare class TransactionModel extends BaseEntityModel implements ITransactionEn
|
|
|
454
463
|
protected constructor();
|
|
455
464
|
static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
|
|
456
465
|
static populateFromEntity(entity: ITransactionEntity): TransactionModel;
|
|
466
|
+
static toReferenceId(entityType: Nullable<TransactionEntityType> | undefined, referenceId: Nullable<number> | undefined): string;
|
|
457
467
|
static toCashBookEntry(tx: TransactionModel): ICashBookEntry;
|
|
458
468
|
static toCashBook(txns: TransactionModel[]): ICashBookEntry[];
|
|
459
469
|
}
|
|
@@ -601,7 +611,7 @@ declare function diffArrays<T>(arr1: T[], arr2: T[]): {
|
|
|
601
611
|
* grouped.get('keyValue2'); // [item3]
|
|
602
612
|
*/
|
|
603
613
|
declare function groupBy<T>(items: T[], key: keyof T): Map<string, T[]>;
|
|
604
|
-
declare function definedValues<T>(arr: Array<T | undefined
|
|
614
|
+
declare function definedValues<T>(arr: Array<Nullable<T> | undefined>): T[];
|
|
605
615
|
/**
|
|
606
616
|
* Converts an epoch timestamp (milliseconds) into a human-readable date string.
|
|
607
617
|
*
|
|
@@ -619,7 +629,7 @@ declare function definedValues<T>(arr: Array<T | undefined | null>): T[];
|
|
|
619
629
|
* epochToReadableDate(1700000000000, 'short-dt'); // "14/11/23 18:13"
|
|
620
630
|
* epochToReadableDate(1700000000000); // "2023-11-14T18:13:20.000Z"
|
|
621
631
|
*/
|
|
622
|
-
declare function epochToReadableDate(epoch: number | string, format?:
|
|
632
|
+
declare function epochToReadableDate(epoch: number | string, format?: "short" | "long" | "short-dt" | "iso"): string;
|
|
623
633
|
|
|
624
634
|
declare function convertNumberToWords(num: number): string;
|
|
625
635
|
|
|
@@ -797,4 +807,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
|
|
|
797
807
|
interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
|
|
798
808
|
}
|
|
799
809
|
|
|
800
|
-
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, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
|
810
|
+
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, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,13 @@ declare enum SponsorTier {
|
|
|
58
58
|
GENERAL_SPONSOR = "General Sponsor"
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
declare enum TransactionEntityType {
|
|
62
|
+
DONATION = "donation",
|
|
63
|
+
SPONSOR = "sponsor",
|
|
64
|
+
EXPENSE = "expense",
|
|
65
|
+
DAAN_PETI = "daan_peti"
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
declare enum TransactionType {
|
|
62
69
|
INCOME = "Income",
|
|
63
70
|
EXPENSE = "Expense"
|
|
@@ -146,6 +153,13 @@ interface ISponsorEntity extends IAuditColumnEntity {
|
|
|
146
153
|
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
interface IDtoValidationError {
|
|
157
|
+
key: string;
|
|
158
|
+
message: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
type Nullable<T> = T | null;
|
|
162
|
+
|
|
149
163
|
interface ITransactionEntity extends IAuditColumnEntity {
|
|
150
164
|
id: number;
|
|
151
165
|
date: string;
|
|
@@ -153,7 +167,8 @@ interface ITransactionEntity extends IAuditColumnEntity {
|
|
|
153
167
|
particulars: string;
|
|
154
168
|
amount: number;
|
|
155
169
|
balanceAfter: number;
|
|
156
|
-
referenceId:
|
|
170
|
+
referenceId: Nullable<number>;
|
|
171
|
+
entityType?: Nullable<TransactionEntityType>;
|
|
157
172
|
paymentType: PaymentType;
|
|
158
173
|
status?: EntityStatus;
|
|
159
174
|
}
|
|
@@ -161,13 +176,6 @@ interface ITransactionEntity extends IAuditColumnEntity {
|
|
|
161
176
|
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
162
177
|
}
|
|
163
178
|
|
|
164
|
-
interface IDtoValidationError {
|
|
165
|
-
key: string;
|
|
166
|
-
message: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type Nullable<T> = T | null;
|
|
170
|
-
|
|
171
179
|
/**
|
|
172
180
|
* Utility class for validating date codes in `YYYYMMDD` format.
|
|
173
181
|
*
|
|
@@ -346,19 +354,19 @@ interface FlatDonationLike {
|
|
|
346
354
|
amount: number;
|
|
347
355
|
donationYear?: number;
|
|
348
356
|
createdOn?: number;
|
|
349
|
-
createdByUser?: {
|
|
357
|
+
createdByUser?: Nullable<{
|
|
350
358
|
name?: string;
|
|
351
|
-
}
|
|
352
|
-
updatedByUser?: {
|
|
359
|
+
}>;
|
|
360
|
+
updatedByUser?: Nullable<{
|
|
353
361
|
name?: string;
|
|
354
|
-
}
|
|
362
|
+
}>;
|
|
355
363
|
}
|
|
356
364
|
type FlatCollectionStatus = "Paid" | "Pending";
|
|
357
365
|
interface FlatCollectionEntry {
|
|
358
366
|
flatNumber: string;
|
|
359
367
|
status: FlatCollectionStatus;
|
|
360
368
|
amount: number;
|
|
361
|
-
latestDonation?: FlatDonationLike
|
|
369
|
+
latestDonation?: Nullable<FlatDonationLike>;
|
|
362
370
|
}
|
|
363
371
|
interface FlatParseResult {
|
|
364
372
|
wing?: string;
|
|
@@ -442,7 +450,8 @@ declare class TransactionModel extends BaseEntityModel implements ITransactionEn
|
|
|
442
450
|
particulars: string;
|
|
443
451
|
amount: number;
|
|
444
452
|
balanceAfter: number;
|
|
445
|
-
referenceId:
|
|
453
|
+
referenceId: Nullable<number>;
|
|
454
|
+
entityType: Nullable<TransactionEntityType>;
|
|
446
455
|
paymentType: PaymentType;
|
|
447
456
|
status: EntityStatus;
|
|
448
457
|
createdOn: number;
|
|
@@ -454,6 +463,7 @@ declare class TransactionModel extends BaseEntityModel implements ITransactionEn
|
|
|
454
463
|
protected constructor();
|
|
455
464
|
static relations: Partial<Record<EntityList, IModelRelationConfig<EntityList>>>;
|
|
456
465
|
static populateFromEntity(entity: ITransactionEntity): TransactionModel;
|
|
466
|
+
static toReferenceId(entityType: Nullable<TransactionEntityType> | undefined, referenceId: Nullable<number> | undefined): string;
|
|
457
467
|
static toCashBookEntry(tx: TransactionModel): ICashBookEntry;
|
|
458
468
|
static toCashBook(txns: TransactionModel[]): ICashBookEntry[];
|
|
459
469
|
}
|
|
@@ -601,7 +611,7 @@ declare function diffArrays<T>(arr1: T[], arr2: T[]): {
|
|
|
601
611
|
* grouped.get('keyValue2'); // [item3]
|
|
602
612
|
*/
|
|
603
613
|
declare function groupBy<T>(items: T[], key: keyof T): Map<string, T[]>;
|
|
604
|
-
declare function definedValues<T>(arr: Array<T | undefined
|
|
614
|
+
declare function definedValues<T>(arr: Array<Nullable<T> | undefined>): T[];
|
|
605
615
|
/**
|
|
606
616
|
* Converts an epoch timestamp (milliseconds) into a human-readable date string.
|
|
607
617
|
*
|
|
@@ -619,7 +629,7 @@ declare function definedValues<T>(arr: Array<T | undefined | null>): T[];
|
|
|
619
629
|
* epochToReadableDate(1700000000000, 'short-dt'); // "14/11/23 18:13"
|
|
620
630
|
* epochToReadableDate(1700000000000); // "2023-11-14T18:13:20.000Z"
|
|
621
631
|
*/
|
|
622
|
-
declare function epochToReadableDate(epoch: number | string, format?:
|
|
632
|
+
declare function epochToReadableDate(epoch: number | string, format?: "short" | "long" | "short-dt" | "iso"): string;
|
|
623
633
|
|
|
624
634
|
declare function convertNumberToWords(num: number): string;
|
|
625
635
|
|
|
@@ -797,4 +807,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
|
|
|
797
807
|
interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
|
|
798
808
|
}
|
|
799
809
|
|
|
800
|
-
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, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
|
810
|
+
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, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
SponsorHistoryModel: () => SponsorHistoryModel,
|
|
52
52
|
SponsorModel: () => SponsorModel,
|
|
53
53
|
SponsorTier: () => SponsorTier,
|
|
54
|
+
TransactionEntityType: () => TransactionEntityType,
|
|
54
55
|
TransactionHistoryModel: () => TransactionHistoryModel,
|
|
55
56
|
TransactionModel: () => TransactionModel,
|
|
56
57
|
TransactionType: () => TransactionType,
|
|
@@ -475,6 +476,15 @@ var SponsorTier = /* @__PURE__ */ ((SponsorTier2) => {
|
|
|
475
476
|
return SponsorTier2;
|
|
476
477
|
})(SponsorTier || {});
|
|
477
478
|
|
|
479
|
+
// src/enums/transaction-entity-type.enum.ts
|
|
480
|
+
var TransactionEntityType = /* @__PURE__ */ ((TransactionEntityType3) => {
|
|
481
|
+
TransactionEntityType3["DONATION"] = "donation";
|
|
482
|
+
TransactionEntityType3["SPONSOR"] = "sponsor";
|
|
483
|
+
TransactionEntityType3["EXPENSE"] = "expense";
|
|
484
|
+
TransactionEntityType3["DAAN_PETI"] = "daan_peti";
|
|
485
|
+
return TransactionEntityType3;
|
|
486
|
+
})(TransactionEntityType || {});
|
|
487
|
+
|
|
478
488
|
// src/enums/transaction-type.enum.ts
|
|
479
489
|
var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
480
490
|
TransactionType2["INCOME"] = "Income";
|
|
@@ -769,7 +779,9 @@ var _DonationModel = class _DonationModel extends BaseEntityModel {
|
|
|
769
779
|
return `MPCR-${year}-${flatNo}`;
|
|
770
780
|
}
|
|
771
781
|
static generateReceiptNumber(flatNo, existingDonations) {
|
|
772
|
-
const count = existingDonations.filter(
|
|
782
|
+
const count = existingDonations.filter(
|
|
783
|
+
(d) => d.status === "Active" /* ACTIVE */ && d.flatNo === flatNo
|
|
784
|
+
).length + 1;
|
|
773
785
|
const seq = String(count).padStart(2, "0");
|
|
774
786
|
return `${_DonationModel.getReceiptPrefix(flatNo)}-${seq}`;
|
|
775
787
|
}
|
|
@@ -1122,7 +1134,8 @@ var _TransactionModel = class _TransactionModel extends BaseEntityModel {
|
|
|
1122
1134
|
this.particulars = "";
|
|
1123
1135
|
this.amount = 0;
|
|
1124
1136
|
this.balanceAfter = 0;
|
|
1125
|
-
this.referenceId =
|
|
1137
|
+
this.referenceId = null;
|
|
1138
|
+
this.entityType = null;
|
|
1126
1139
|
this.paymentType = "Cash" /* CASH */;
|
|
1127
1140
|
this.status = "Active" /* ACTIVE */;
|
|
1128
1141
|
this.createdOn = 0;
|
|
@@ -1133,9 +1146,16 @@ var _TransactionModel = class _TransactionModel extends BaseEntityModel {
|
|
|
1133
1146
|
static populateFromEntity(entity) {
|
|
1134
1147
|
return Object.assign(new _TransactionModel(), entity, {
|
|
1135
1148
|
amount: Number(entity.amount),
|
|
1136
|
-
balanceAfter: Number(entity.balanceAfter)
|
|
1149
|
+
balanceAfter: Number(entity.balanceAfter),
|
|
1150
|
+
referenceId: entity.referenceId != null ? Number(entity.referenceId) : null
|
|
1137
1151
|
});
|
|
1138
1152
|
}
|
|
1153
|
+
static toReferenceId(entityType, referenceId) {
|
|
1154
|
+
if (entityType == null) {
|
|
1155
|
+
return referenceId != null ? String(referenceId) : "";
|
|
1156
|
+
}
|
|
1157
|
+
return referenceId != null ? `${entityType}-${referenceId}` : entityType;
|
|
1158
|
+
}
|
|
1139
1159
|
static toCashBookEntry(tx) {
|
|
1140
1160
|
const isExpense = tx.type === "Expense" /* EXPENSE */;
|
|
1141
1161
|
return {
|
|
@@ -1144,7 +1164,10 @@ var _TransactionModel = class _TransactionModel extends BaseEntityModel {
|
|
|
1144
1164
|
receipt: isExpense ? 0 : tx.amount,
|
|
1145
1165
|
payment: isExpense ? tx.amount : 0,
|
|
1146
1166
|
balance: tx.balanceAfter,
|
|
1147
|
-
referenceId:
|
|
1167
|
+
referenceId: _TransactionModel.toReferenceId(
|
|
1168
|
+
tx.entityType,
|
|
1169
|
+
tx.referenceId
|
|
1170
|
+
)
|
|
1148
1171
|
};
|
|
1149
1172
|
}
|
|
1150
1173
|
static toCashBook(txns) {
|
|
@@ -1615,6 +1638,7 @@ var USER_RELATION_CONFIG = {
|
|
|
1615
1638
|
SponsorHistoryModel,
|
|
1616
1639
|
SponsorModel,
|
|
1617
1640
|
SponsorTier,
|
|
1641
|
+
TransactionEntityType,
|
|
1618
1642
|
TransactionHistoryModel,
|
|
1619
1643
|
TransactionModel,
|
|
1620
1644
|
TransactionType,
|