@mody-park-cha-raja/finance_common 4.29.1-beta.8 → 4.30.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 +118 -53
- package/dist/index.d.ts +118 -53
- package/dist/index.js +473 -345
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +471 -345
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -157,31 +157,6 @@ interface IExpenseEntity extends IAuditColumnEntity {
|
|
|
157
157
|
interface IFlatHistoryEntity extends IBaseHistoryEntity {
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
interface IFlatEntity extends IAuditColumnEntity {
|
|
161
|
-
id: number;
|
|
162
|
-
wing: string;
|
|
163
|
-
unitNumber: string;
|
|
164
|
-
status: EntityStatus;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
interface ISponsorHistoryEntity extends IBaseHistoryEntity {
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
interface ISponsorEntity extends IAuditColumnEntity {
|
|
171
|
-
id: number;
|
|
172
|
-
sponsorName: string;
|
|
173
|
-
contactName: string;
|
|
174
|
-
contactNo: string;
|
|
175
|
-
sponsorFor: string;
|
|
176
|
-
size: string;
|
|
177
|
-
amount: number;
|
|
178
|
-
paymentType: PaymentType;
|
|
179
|
-
status?: EntityStatus;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
183
|
-
}
|
|
184
|
-
|
|
185
160
|
interface IDtoValidationError {
|
|
186
161
|
key: string;
|
|
187
162
|
message: string;
|
|
@@ -189,22 +164,6 @@ interface IDtoValidationError {
|
|
|
189
164
|
|
|
190
165
|
type Nullable<T> = T | null;
|
|
191
166
|
|
|
192
|
-
interface ITransactionEntity extends IAuditColumnEntity {
|
|
193
|
-
id: number;
|
|
194
|
-
date: string;
|
|
195
|
-
type: TransactionType;
|
|
196
|
-
particulars: string;
|
|
197
|
-
amount: number;
|
|
198
|
-
balanceAfter: number;
|
|
199
|
-
referenceId: Nullable<number>;
|
|
200
|
-
entityType?: Nullable<TransactionEntityType>;
|
|
201
|
-
paymentType: PaymentType;
|
|
202
|
-
status?: EntityStatus;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
206
|
-
}
|
|
207
|
-
|
|
208
167
|
/**
|
|
209
168
|
* Utility class for validating date codes in `YYYYMMDD` format.
|
|
210
169
|
*
|
|
@@ -258,6 +217,56 @@ interface ICashBookEntry {
|
|
|
258
217
|
referenceId: string;
|
|
259
218
|
}
|
|
260
219
|
|
|
220
|
+
interface ISponsorHistoryEntity extends IBaseHistoryEntity {
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface ISponsorEntity extends IAuditColumnEntity {
|
|
224
|
+
id: number;
|
|
225
|
+
sponsorName: string;
|
|
226
|
+
contactName: string;
|
|
227
|
+
contactNo: string;
|
|
228
|
+
sponsorFor: string;
|
|
229
|
+
size: string;
|
|
230
|
+
amount: number;
|
|
231
|
+
paymentType: PaymentType;
|
|
232
|
+
status?: EntityStatus;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ITransactionEntity extends IAuditColumnEntity {
|
|
239
|
+
id: number;
|
|
240
|
+
date: string;
|
|
241
|
+
type: TransactionType;
|
|
242
|
+
particulars: string;
|
|
243
|
+
amount: number;
|
|
244
|
+
balanceAfter: number;
|
|
245
|
+
referenceId: Nullable<number>;
|
|
246
|
+
entityType?: Nullable<TransactionEntityType>;
|
|
247
|
+
paymentType: PaymentType;
|
|
248
|
+
status?: EntityStatus;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface IUserEntity extends IAuditColumnEntity {
|
|
255
|
+
id: number;
|
|
256
|
+
name: string;
|
|
257
|
+
password: string;
|
|
258
|
+
email: string;
|
|
259
|
+
phone: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* This is a common config for user entity
|
|
263
|
+
* this will be used for createdBy & updatedBy
|
|
264
|
+
* for the tables
|
|
265
|
+
*
|
|
266
|
+
* Adding column keys reduce the bandwidth that is used
|
|
267
|
+
*/
|
|
268
|
+
declare const USER_RELATION_CONFIG: IEntityFilterSearchData<EntityList.USER>;
|
|
269
|
+
|
|
261
270
|
interface IVendorHistoryEntity extends IBaseHistoryEntity {
|
|
262
271
|
}
|
|
263
272
|
|
|
@@ -314,10 +323,16 @@ interface FlatDonationLike {
|
|
|
314
323
|
type FlatCollectionStatus = "Paid" | "Pending";
|
|
315
324
|
interface FlatCollectionEntry {
|
|
316
325
|
flatNumber: string;
|
|
326
|
+
/** Flat entity id — present on entries built by computeCollectionStatusByFlatId. */
|
|
327
|
+
flatId?: number;
|
|
317
328
|
status: FlatCollectionStatus;
|
|
318
329
|
amount: number;
|
|
319
330
|
latestDonation?: Nullable<FlatDonationLike>;
|
|
320
331
|
}
|
|
332
|
+
/** Donation shape matched by flat entity id (flatId-only reads). */
|
|
333
|
+
interface FlatIdDonationLike extends Omit<FlatDonationLike, "flatNo"> {
|
|
334
|
+
flatId?: number | null;
|
|
335
|
+
}
|
|
321
336
|
interface FlatParseResult {
|
|
322
337
|
wing?: string;
|
|
323
338
|
num?: string;
|
|
@@ -377,10 +392,30 @@ declare class FlatModel extends BaseEntityModel implements IFlatEntity {
|
|
|
377
392
|
static parseFlatNumber(flatNo: string, specials?: readonly string[]): FlatParseResult;
|
|
378
393
|
static getFlatOptions(wing: string, specials?: readonly string[]): FlatOption[];
|
|
379
394
|
static getDisplayLabel(wing: string, flatNo: string, specials?: readonly string[]): string;
|
|
395
|
+
/**
|
|
396
|
+
* Builds the display label ("A-101", or the special label itself) from a
|
|
397
|
+
* flat entity. Returns "" when no flat is available. This is the single
|
|
398
|
+
* source for donation-facing labels — the stored `donation.flatNo` string
|
|
399
|
+
* must never be read by application logic.
|
|
400
|
+
*/
|
|
401
|
+
static getFlatLabel(flat?: Nullable<{
|
|
402
|
+
wing?: string | null;
|
|
403
|
+
unitNumber?: string;
|
|
404
|
+
}> | null): string;
|
|
380
405
|
static computeCollectionStatus(donations: FlatDonationLike[], year: number, flats?: ReadonlyArray<{
|
|
381
406
|
wing?: string | null;
|
|
382
407
|
unitNumber: string;
|
|
383
408
|
}>): FlatCollectionEntry[];
|
|
409
|
+
/**
|
|
410
|
+
* flatId-keyed variant of computeCollectionStatus — one entry per flat
|
|
411
|
+
* ENTITY (specials included by id), donations matched by `d.flatId`.
|
|
412
|
+
* Donations without a resolvable flatId are silently excluded.
|
|
413
|
+
*/
|
|
414
|
+
static computeCollectionStatusByFlatId(flats: ReadonlyArray<{
|
|
415
|
+
id: number;
|
|
416
|
+
wing?: string | null;
|
|
417
|
+
unitNumber: string;
|
|
418
|
+
}>, donations: readonly FlatIdDonationLike[], year: number): FlatCollectionEntry[];
|
|
384
419
|
static compareFlatNumbers(a: string, b: string, specials?: readonly string[]): number;
|
|
385
420
|
static convertNumberToWords(num: number): string;
|
|
386
421
|
}
|
|
@@ -419,6 +454,19 @@ declare class DonationModel extends BaseEntityModel implements IDonationEntity {
|
|
|
419
454
|
static sumActiveDonations(donations: DonationModel[]): number;
|
|
420
455
|
static getReceiptPrefix(flatNo: string): string;
|
|
421
456
|
static generateReceiptNumber(flatNo: string, existingDonations: DonationModel[]): string;
|
|
457
|
+
/**
|
|
458
|
+
* flatId-keyed variant of generateReceiptNumber — sequence is counted per
|
|
459
|
+
* flat ENTITY id and the prefix label is derived from the flat itself
|
|
460
|
+
* (wing-unitNumber, or the special label). Never reads `donation.flatNo`.
|
|
461
|
+
*/
|
|
462
|
+
static generateReceiptNumberForFlat(flat: {
|
|
463
|
+
id: number;
|
|
464
|
+
wing?: string | null;
|
|
465
|
+
unitNumber?: string;
|
|
466
|
+
}, existing: ReadonlyArray<{
|
|
467
|
+
flatId?: number | null;
|
|
468
|
+
status?: EntityStatus;
|
|
469
|
+
}>): string;
|
|
422
470
|
static toWhatsAppNumber(mobile: string): string;
|
|
423
471
|
}
|
|
424
472
|
|
|
@@ -870,6 +918,26 @@ type FlatScopeRow = {
|
|
|
870
918
|
declare function getWingSelectionLabel(selection: string, specials?: readonly string[]): string;
|
|
871
919
|
declare function getWingSelectionSlug(selection: string, specials?: readonly string[]): string;
|
|
872
920
|
declare function buildWingWiseCollectionReport(donations: WingCollectionDonationLike[], year: number, selection: string, flats?: readonly FlatScopeRow[]): WingCollectionReport;
|
|
921
|
+
/** Donation shape matched by flat entity id (flatId-only reads). */
|
|
922
|
+
interface WingCollectionDonationByIdLike {
|
|
923
|
+
flatId?: Nullable<number>;
|
|
924
|
+
amount: number;
|
|
925
|
+
receiptNumber?: string;
|
|
926
|
+
paymentType?: string;
|
|
927
|
+
createdOn?: number;
|
|
928
|
+
}
|
|
929
|
+
type FlatIdScopeRow = {
|
|
930
|
+
id: number;
|
|
931
|
+
wing?: string | null;
|
|
932
|
+
unitNumber: string;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* flatId-keyed variant of buildWingWiseCollectionReport — donations are
|
|
936
|
+
* grouped by their flat ENTITY id and labels derive from the flat itself.
|
|
937
|
+
* Donations without a resolvable flat are silently excluded. The flats list
|
|
938
|
+
* is required (ids cannot be inferred from statics).
|
|
939
|
+
*/
|
|
940
|
+
declare function buildWingWiseCollectionReportByFlatId(donations: WingCollectionDonationByIdLike[], year: number, selection: string, flats: readonly FlatIdScopeRow[]): WingCollectionReport;
|
|
873
941
|
declare function buildWingWiseCollectionWorkbook(report: WingCollectionReport): XLSX.WorkBook;
|
|
874
942
|
|
|
875
943
|
type XlsxSerializationType = 'base64' | 'array' | 'binary';
|
|
@@ -895,21 +963,18 @@ interface XlsxSheetInput {
|
|
|
895
963
|
declare function buildXlsxWorkbook(sheets: XlsxSheetInput[]): XLSX.WorkBook;
|
|
896
964
|
declare function serializeXlsx(workbook: XLSX.WorkBook, type: XlsxSerializationType): string | ArrayBuffer;
|
|
897
965
|
|
|
898
|
-
interface
|
|
966
|
+
interface IFlatEntity extends IAuditColumnEntity {
|
|
899
967
|
id: number;
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
phone: string;
|
|
968
|
+
wing: string;
|
|
969
|
+
unitNumber: string;
|
|
970
|
+
status: EntityStatus;
|
|
904
971
|
}
|
|
905
972
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
* for
|
|
909
|
-
*
|
|
910
|
-
* Adding column keys reduce the bandwidth that is used
|
|
973
|
+
* Relation entry for hydrating the flat referenced by a donation.
|
|
974
|
+
* Attach via searchV2 `relations` so donations carry their flat entity
|
|
975
|
+
* (label = wing-unitNumber, or unitNumber alone for specials).
|
|
911
976
|
*/
|
|
912
|
-
declare const
|
|
977
|
+
declare const FLAT_DONATION_RELATION_CONFIG: IEntityFilterSearchData<EntityList.FLAT>;
|
|
913
978
|
|
|
914
979
|
declare enum EntityList {
|
|
915
980
|
DONATION = "donation",
|
|
@@ -1082,4 +1147,4 @@ declare function isSpecialFlatLabel(label: string): boolean;
|
|
|
1082
1147
|
declare function getFlatValidationErrors(input: Partial<IFlatEntity>): FlatValidationError[];
|
|
1083
1148
|
declare function validateFlatOrThrow(input: Partial<IFlatEntity>): void;
|
|
1084
1149
|
|
|
1085
|
-
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHeadHistoryModel, ExpenseHeadModel, ExpenseHistoryModel, ExpenseModel, FLATS_BY_WING, FLAT_NUMBERS, FLAT_UNIT_NUMBER_PATTERN, FLAT_WING_PATTERN, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatHistoryModel, FlatModel, type FlatOption, type FlatParseResult, type FlatValidationError, 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 IExpenseHeadCreateDto, type IExpenseHeadEntity, type IExpenseHeadHistoryEntity, type IExpenseHeadSearchDto, type IExpenseHeadUpdateDto, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IFlatCreateDto, type IFlatEntity, type IFlatHistoryEntity, type IFlatSearchDto, type IFlatUpdateDto, 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, SHOP_UNIT_NUMBER_PATTERN, SHOP_WING, SPECIAL_FLATS, SPECIAL_FLAT_LABELS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, WING_ALPHABETS, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getFlatValidationErrors, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, isSpecialFlatLabel, isValidFlatWing, roundToTwoDecimals, serializeXlsx, validateFlatOrThrow };
|
|
1150
|
+
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHeadHistoryModel, ExpenseHeadModel, ExpenseHistoryModel, ExpenseModel, FLATS_BY_WING, FLAT_DONATION_RELATION_CONFIG, FLAT_NUMBERS, FLAT_UNIT_NUMBER_PATTERN, FLAT_WING_PATTERN, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatHistoryModel, type FlatIdDonationLike, FlatModel, type FlatOption, type FlatParseResult, type FlatValidationError, 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 IExpenseHeadCreateDto, type IExpenseHeadEntity, type IExpenseHeadHistoryEntity, type IExpenseHeadSearchDto, type IExpenseHeadUpdateDto, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IFlatCreateDto, type IFlatEntity, type IFlatHistoryEntity, type IFlatSearchDto, type IFlatUpdateDto, 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, SHOP_UNIT_NUMBER_PATTERN, SHOP_WING, SPECIAL_FLATS, SPECIAL_FLAT_LABELS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, WING_ALPHABETS, type WingCollectionDonationByIdLike, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionReportByFlatId, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getFlatValidationErrors, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, isSpecialFlatLabel, isValidFlatWing, roundToTwoDecimals, serializeXlsx, validateFlatOrThrow };
|
package/dist/index.d.ts
CHANGED
|
@@ -157,31 +157,6 @@ interface IExpenseEntity extends IAuditColumnEntity {
|
|
|
157
157
|
interface IFlatHistoryEntity extends IBaseHistoryEntity {
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
interface IFlatEntity extends IAuditColumnEntity {
|
|
161
|
-
id: number;
|
|
162
|
-
wing: string;
|
|
163
|
-
unitNumber: string;
|
|
164
|
-
status: EntityStatus;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
interface ISponsorHistoryEntity extends IBaseHistoryEntity {
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
interface ISponsorEntity extends IAuditColumnEntity {
|
|
171
|
-
id: number;
|
|
172
|
-
sponsorName: string;
|
|
173
|
-
contactName: string;
|
|
174
|
-
contactNo: string;
|
|
175
|
-
sponsorFor: string;
|
|
176
|
-
size: string;
|
|
177
|
-
amount: number;
|
|
178
|
-
paymentType: PaymentType;
|
|
179
|
-
status?: EntityStatus;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
183
|
-
}
|
|
184
|
-
|
|
185
160
|
interface IDtoValidationError {
|
|
186
161
|
key: string;
|
|
187
162
|
message: string;
|
|
@@ -189,22 +164,6 @@ interface IDtoValidationError {
|
|
|
189
164
|
|
|
190
165
|
type Nullable<T> = T | null;
|
|
191
166
|
|
|
192
|
-
interface ITransactionEntity extends IAuditColumnEntity {
|
|
193
|
-
id: number;
|
|
194
|
-
date: string;
|
|
195
|
-
type: TransactionType;
|
|
196
|
-
particulars: string;
|
|
197
|
-
amount: number;
|
|
198
|
-
balanceAfter: number;
|
|
199
|
-
referenceId: Nullable<number>;
|
|
200
|
-
entityType?: Nullable<TransactionEntityType>;
|
|
201
|
-
paymentType: PaymentType;
|
|
202
|
-
status?: EntityStatus;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
206
|
-
}
|
|
207
|
-
|
|
208
167
|
/**
|
|
209
168
|
* Utility class for validating date codes in `YYYYMMDD` format.
|
|
210
169
|
*
|
|
@@ -258,6 +217,56 @@ interface ICashBookEntry {
|
|
|
258
217
|
referenceId: string;
|
|
259
218
|
}
|
|
260
219
|
|
|
220
|
+
interface ISponsorHistoryEntity extends IBaseHistoryEntity {
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface ISponsorEntity extends IAuditColumnEntity {
|
|
224
|
+
id: number;
|
|
225
|
+
sponsorName: string;
|
|
226
|
+
contactName: string;
|
|
227
|
+
contactNo: string;
|
|
228
|
+
sponsorFor: string;
|
|
229
|
+
size: string;
|
|
230
|
+
amount: number;
|
|
231
|
+
paymentType: PaymentType;
|
|
232
|
+
status?: EntityStatus;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface ITransactionHistoryEntity extends IBaseHistoryEntity {
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ITransactionEntity extends IAuditColumnEntity {
|
|
239
|
+
id: number;
|
|
240
|
+
date: string;
|
|
241
|
+
type: TransactionType;
|
|
242
|
+
particulars: string;
|
|
243
|
+
amount: number;
|
|
244
|
+
balanceAfter: number;
|
|
245
|
+
referenceId: Nullable<number>;
|
|
246
|
+
entityType?: Nullable<TransactionEntityType>;
|
|
247
|
+
paymentType: PaymentType;
|
|
248
|
+
status?: EntityStatus;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface IUserHistoryEntity extends IBaseHistoryEntity {
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface IUserEntity extends IAuditColumnEntity {
|
|
255
|
+
id: number;
|
|
256
|
+
name: string;
|
|
257
|
+
password: string;
|
|
258
|
+
email: string;
|
|
259
|
+
phone: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* This is a common config for user entity
|
|
263
|
+
* this will be used for createdBy & updatedBy
|
|
264
|
+
* for the tables
|
|
265
|
+
*
|
|
266
|
+
* Adding column keys reduce the bandwidth that is used
|
|
267
|
+
*/
|
|
268
|
+
declare const USER_RELATION_CONFIG: IEntityFilterSearchData<EntityList.USER>;
|
|
269
|
+
|
|
261
270
|
interface IVendorHistoryEntity extends IBaseHistoryEntity {
|
|
262
271
|
}
|
|
263
272
|
|
|
@@ -314,10 +323,16 @@ interface FlatDonationLike {
|
|
|
314
323
|
type FlatCollectionStatus = "Paid" | "Pending";
|
|
315
324
|
interface FlatCollectionEntry {
|
|
316
325
|
flatNumber: string;
|
|
326
|
+
/** Flat entity id — present on entries built by computeCollectionStatusByFlatId. */
|
|
327
|
+
flatId?: number;
|
|
317
328
|
status: FlatCollectionStatus;
|
|
318
329
|
amount: number;
|
|
319
330
|
latestDonation?: Nullable<FlatDonationLike>;
|
|
320
331
|
}
|
|
332
|
+
/** Donation shape matched by flat entity id (flatId-only reads). */
|
|
333
|
+
interface FlatIdDonationLike extends Omit<FlatDonationLike, "flatNo"> {
|
|
334
|
+
flatId?: number | null;
|
|
335
|
+
}
|
|
321
336
|
interface FlatParseResult {
|
|
322
337
|
wing?: string;
|
|
323
338
|
num?: string;
|
|
@@ -377,10 +392,30 @@ declare class FlatModel extends BaseEntityModel implements IFlatEntity {
|
|
|
377
392
|
static parseFlatNumber(flatNo: string, specials?: readonly string[]): FlatParseResult;
|
|
378
393
|
static getFlatOptions(wing: string, specials?: readonly string[]): FlatOption[];
|
|
379
394
|
static getDisplayLabel(wing: string, flatNo: string, specials?: readonly string[]): string;
|
|
395
|
+
/**
|
|
396
|
+
* Builds the display label ("A-101", or the special label itself) from a
|
|
397
|
+
* flat entity. Returns "" when no flat is available. This is the single
|
|
398
|
+
* source for donation-facing labels — the stored `donation.flatNo` string
|
|
399
|
+
* must never be read by application logic.
|
|
400
|
+
*/
|
|
401
|
+
static getFlatLabel(flat?: Nullable<{
|
|
402
|
+
wing?: string | null;
|
|
403
|
+
unitNumber?: string;
|
|
404
|
+
}> | null): string;
|
|
380
405
|
static computeCollectionStatus(donations: FlatDonationLike[], year: number, flats?: ReadonlyArray<{
|
|
381
406
|
wing?: string | null;
|
|
382
407
|
unitNumber: string;
|
|
383
408
|
}>): FlatCollectionEntry[];
|
|
409
|
+
/**
|
|
410
|
+
* flatId-keyed variant of computeCollectionStatus — one entry per flat
|
|
411
|
+
* ENTITY (specials included by id), donations matched by `d.flatId`.
|
|
412
|
+
* Donations without a resolvable flatId are silently excluded.
|
|
413
|
+
*/
|
|
414
|
+
static computeCollectionStatusByFlatId(flats: ReadonlyArray<{
|
|
415
|
+
id: number;
|
|
416
|
+
wing?: string | null;
|
|
417
|
+
unitNumber: string;
|
|
418
|
+
}>, donations: readonly FlatIdDonationLike[], year: number): FlatCollectionEntry[];
|
|
384
419
|
static compareFlatNumbers(a: string, b: string, specials?: readonly string[]): number;
|
|
385
420
|
static convertNumberToWords(num: number): string;
|
|
386
421
|
}
|
|
@@ -419,6 +454,19 @@ declare class DonationModel extends BaseEntityModel implements IDonationEntity {
|
|
|
419
454
|
static sumActiveDonations(donations: DonationModel[]): number;
|
|
420
455
|
static getReceiptPrefix(flatNo: string): string;
|
|
421
456
|
static generateReceiptNumber(flatNo: string, existingDonations: DonationModel[]): string;
|
|
457
|
+
/**
|
|
458
|
+
* flatId-keyed variant of generateReceiptNumber — sequence is counted per
|
|
459
|
+
* flat ENTITY id and the prefix label is derived from the flat itself
|
|
460
|
+
* (wing-unitNumber, or the special label). Never reads `donation.flatNo`.
|
|
461
|
+
*/
|
|
462
|
+
static generateReceiptNumberForFlat(flat: {
|
|
463
|
+
id: number;
|
|
464
|
+
wing?: string | null;
|
|
465
|
+
unitNumber?: string;
|
|
466
|
+
}, existing: ReadonlyArray<{
|
|
467
|
+
flatId?: number | null;
|
|
468
|
+
status?: EntityStatus;
|
|
469
|
+
}>): string;
|
|
422
470
|
static toWhatsAppNumber(mobile: string): string;
|
|
423
471
|
}
|
|
424
472
|
|
|
@@ -870,6 +918,26 @@ type FlatScopeRow = {
|
|
|
870
918
|
declare function getWingSelectionLabel(selection: string, specials?: readonly string[]): string;
|
|
871
919
|
declare function getWingSelectionSlug(selection: string, specials?: readonly string[]): string;
|
|
872
920
|
declare function buildWingWiseCollectionReport(donations: WingCollectionDonationLike[], year: number, selection: string, flats?: readonly FlatScopeRow[]): WingCollectionReport;
|
|
921
|
+
/** Donation shape matched by flat entity id (flatId-only reads). */
|
|
922
|
+
interface WingCollectionDonationByIdLike {
|
|
923
|
+
flatId?: Nullable<number>;
|
|
924
|
+
amount: number;
|
|
925
|
+
receiptNumber?: string;
|
|
926
|
+
paymentType?: string;
|
|
927
|
+
createdOn?: number;
|
|
928
|
+
}
|
|
929
|
+
type FlatIdScopeRow = {
|
|
930
|
+
id: number;
|
|
931
|
+
wing?: string | null;
|
|
932
|
+
unitNumber: string;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* flatId-keyed variant of buildWingWiseCollectionReport — donations are
|
|
936
|
+
* grouped by their flat ENTITY id and labels derive from the flat itself.
|
|
937
|
+
* Donations without a resolvable flat are silently excluded. The flats list
|
|
938
|
+
* is required (ids cannot be inferred from statics).
|
|
939
|
+
*/
|
|
940
|
+
declare function buildWingWiseCollectionReportByFlatId(donations: WingCollectionDonationByIdLike[], year: number, selection: string, flats: readonly FlatIdScopeRow[]): WingCollectionReport;
|
|
873
941
|
declare function buildWingWiseCollectionWorkbook(report: WingCollectionReport): XLSX.WorkBook;
|
|
874
942
|
|
|
875
943
|
type XlsxSerializationType = 'base64' | 'array' | 'binary';
|
|
@@ -895,21 +963,18 @@ interface XlsxSheetInput {
|
|
|
895
963
|
declare function buildXlsxWorkbook(sheets: XlsxSheetInput[]): XLSX.WorkBook;
|
|
896
964
|
declare function serializeXlsx(workbook: XLSX.WorkBook, type: XlsxSerializationType): string | ArrayBuffer;
|
|
897
965
|
|
|
898
|
-
interface
|
|
966
|
+
interface IFlatEntity extends IAuditColumnEntity {
|
|
899
967
|
id: number;
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
phone: string;
|
|
968
|
+
wing: string;
|
|
969
|
+
unitNumber: string;
|
|
970
|
+
status: EntityStatus;
|
|
904
971
|
}
|
|
905
972
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
* for
|
|
909
|
-
*
|
|
910
|
-
* Adding column keys reduce the bandwidth that is used
|
|
973
|
+
* Relation entry for hydrating the flat referenced by a donation.
|
|
974
|
+
* Attach via searchV2 `relations` so donations carry their flat entity
|
|
975
|
+
* (label = wing-unitNumber, or unitNumber alone for specials).
|
|
911
976
|
*/
|
|
912
|
-
declare const
|
|
977
|
+
declare const FLAT_DONATION_RELATION_CONFIG: IEntityFilterSearchData<EntityList.FLAT>;
|
|
913
978
|
|
|
914
979
|
declare enum EntityList {
|
|
915
980
|
DONATION = "donation",
|
|
@@ -1082,4 +1147,4 @@ declare function isSpecialFlatLabel(label: string): boolean;
|
|
|
1082
1147
|
declare function getFlatValidationErrors(input: Partial<IFlatEntity>): FlatValidationError[];
|
|
1083
1148
|
declare function validateFlatOrThrow(input: Partial<IFlatEntity>): void;
|
|
1084
1149
|
|
|
1085
|
-
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHeadHistoryModel, ExpenseHeadModel, ExpenseHistoryModel, ExpenseModel, FLATS_BY_WING, FLAT_NUMBERS, FLAT_UNIT_NUMBER_PATTERN, FLAT_WING_PATTERN, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatHistoryModel, FlatModel, type FlatOption, type FlatParseResult, type FlatValidationError, 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 IExpenseHeadCreateDto, type IExpenseHeadEntity, type IExpenseHeadHistoryEntity, type IExpenseHeadSearchDto, type IExpenseHeadUpdateDto, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IFlatCreateDto, type IFlatEntity, type IFlatHistoryEntity, type IFlatSearchDto, type IFlatUpdateDto, 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, SHOP_UNIT_NUMBER_PATTERN, SHOP_WING, SPECIAL_FLATS, SPECIAL_FLAT_LABELS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, WING_ALPHABETS, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getFlatValidationErrors, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, isSpecialFlatLabel, isValidFlatWing, roundToTwoDecimals, serializeXlsx, validateFlatOrThrow };
|
|
1150
|
+
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHeadHistoryModel, ExpenseHeadModel, ExpenseHistoryModel, ExpenseModel, FLATS_BY_WING, FLAT_DONATION_RELATION_CONFIG, FLAT_NUMBERS, FLAT_UNIT_NUMBER_PATTERN, FLAT_WING_PATTERN, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatHistoryModel, type FlatIdDonationLike, FlatModel, type FlatOption, type FlatParseResult, type FlatValidationError, 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 IExpenseHeadCreateDto, type IExpenseHeadEntity, type IExpenseHeadHistoryEntity, type IExpenseHeadSearchDto, type IExpenseHeadUpdateDto, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IFlatCreateDto, type IFlatEntity, type IFlatHistoryEntity, type IFlatSearchDto, type IFlatUpdateDto, 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, SHOP_UNIT_NUMBER_PATTERN, SHOP_WING, SPECIAL_FLATS, SPECIAL_FLAT_LABELS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, WING_ALPHABETS, type WingCollectionDonationByIdLike, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionReportByFlatId, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getFlatValidationErrors, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, isSpecialFlatLabel, isValidFlatWing, roundToTwoDecimals, serializeXlsx, validateFlatOrThrow };
|