-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsfdc-reports.dto.ts
More file actions
949 lines (867 loc) · 26.3 KB
/
Copy pathsfdc-reports.dto.ts
File metadata and controls
949 lines (867 loc) · 26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import {
IsArray,
IsIn,
IsOptional,
IsString,
IsNotEmpty,
IsNumber,
IsDateString,
IsBoolean,
IsEnum,
} from "class-validator";
import { transformArray } from "src/common/validation.util";
export enum ChallengesFilterMode {
BILLING_ACCOUNT = "billingAccount",
CHALLENGE = "challenge",
}
const transformToNumber = ({ value }: { value: unknown }) => {
if (value === undefined || value === null || value === "") {
return undefined;
}
if (typeof value === "number") {
return value;
}
if (typeof value === "string") {
const parsed = parseFloat(value);
return Number.isNaN(parsed) ? value : parsed;
}
return value;
};
export class ChallengesReportQueryDto {
@ApiProperty({
required: false,
description:
"List of billing account IDs to use when filterMode is 'billingAccount' (default). Omit this field when filterMode is 'challenge'.",
example: ["80001012"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
billingAccountIds?: string[];
@ApiProperty({
required: false,
description:
"List of challenge IDs to use when filterMode is 'challenge'. This field is required in challenge mode and must not be combined with billingAccountIds.",
example: ["e74c3e37-73c9-474e-a838-a38dd4738906"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeIds?: string[];
@ApiProperty({
required: false,
description:
"Selects whether to filter primarily by billing account IDs or challenge IDs. Use 'challenge' when providing challengeIds (billingAccountIds are rejected in that mode); defaults to 'billingAccount'.",
enum: ChallengesFilterMode,
example: ChallengesFilterMode.BILLING_ACCOUNT,
default: ChallengesFilterMode.BILLING_ACCOUNT,
})
@IsOptional()
@IsEnum(ChallengesFilterMode)
filterMode?: ChallengesFilterMode;
@ApiProperty({
required: false,
description: "Challenge name to search for",
example: "Task Payment for member",
})
@IsOptional()
@IsString()
@IsNotEmpty()
challengeName?: string;
@ApiProperty({
required: false,
description:
"List of challenge statuses using ChallengeStatusEnum values (for example COMPLETED, ACTIVE).",
example: ["COMPLETED", "ACTIVE"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeStatus?: string[];
@ApiProperty({
required: false,
description:
"Start date (inclusive) for filtering challenge completion/end date in ISO 8601 format",
example: "2023-01-01T00:00:00.000Z",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description:
"End date (inclusive) for filtering challenge completion/end date in ISO 8601 format",
example: "2023-01-31T23:59:59.000Z",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description:
'Filter for task challenges using challenges."Challenge"."taskIsTask"',
example: true,
})
@IsOptional()
@Transform(({ value }) =>
value === undefined ? undefined : value === true || value === "true",
)
@IsBoolean()
isTask?: boolean;
@ApiProperty({
required: false,
description: "List of member handles",
example: ["user_01", "user_02"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
handles?: string[];
@ApiProperty({
required: false,
description: "Minimum line item amount for filtering the report",
example: 100,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
minAmount?: number;
@ApiProperty({
required: false,
description: "Maximum line item amount for filtering the report",
example: 1000,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
maxAmount?: number;
}
export class ChallengesReportResponse {
@ApiProperty({ description: "Challenge identifier" })
challengeId: string;
@ApiProperty({ description: "Challenge name" })
challengeName: string;
@ApiProperty({ description: "Billing account linked to the challenge" })
billingAccountId: string;
@ApiProperty({
description:
'Challenge status pulled from challenges."Challenge".status (ChallengeStatusEnum code, not Looker status_desc)',
})
challengeStatus: string;
@ApiProperty({
description:
'Challenge completion date returned from challenges."Challenge"."endDate"',
})
completeDate: string;
paymentDate: string;
@ApiProperty({
description:
'Indicates whether the challenge is a task from challenges."Challenge"."taskIsTask"',
})
isTask: boolean;
challengeFee: number;
memberPayments: number;
lineItemAmount: number;
memberHandle: string;
memberFirstName: string;
memberLastName: string;
}
export class PaymentsReportQueryDto {
@ApiProperty({
required: false,
description:
"List of billing account IDs associated with the payments to retrieve",
example: ["80001012"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
billingAccountIds?: string[];
@ApiProperty({
required: false,
description:
"Display name search across challenge names and engagement titles.",
example: "Customer Support Engagement",
})
@IsOptional()
@IsString()
@IsNotEmpty()
challengeName?: string;
@ApiProperty({
required: false,
description:
"List of challenge IDs for challenge-backed payments only. Use engagementIds to filter ENGAGEMENT_PAYMENT rows by engagement.",
example: ["e74c3e37-73c9-474e-a838-a38dd4738906"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeIds?: string[];
@ApiProperty({
required: false,
description:
'List of engagement IDs for ENGAGEMENT_PAYMENT rows only. This matches engagements."EngagementAssignment"."engagementId", not finance.winnings.external_id.',
example: ["3cf4ec0b-47e5-4d96-b4c3-ef6af5b0f954"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
engagementIds?: string[];
@ApiProperty({
required: false,
description:
"Start date (inclusive from the start of the America/New_York calendar day) for the report query in YYYY-MM-DD format. For accepted ISO timestamps, only the written calendar-date portion is used",
example: "2023-01-01",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description:
"End date (inclusive through the full America/New_York calendar day) for the report query in YYYY-MM-DD format. For accepted ISO timestamps, only the written calendar-date portion is used",
example: "2023-01-31",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description: "List of user handles",
example: ["user_01", "user_02"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
handles?: string[];
@ApiProperty({
required: false,
description: "Minimum payment amount for filtering the report",
example: 100,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
minPaymentAmount?: number;
@ApiProperty({
required: false,
description: "Maximum payment amount for filtering the report",
example: 1000,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
maxPaymentAmount?: number;
@ApiProperty({
required: false,
description:
"List of challenge statuses for challenge-backed payments only. Engagement payment rows have no challenge status and are excluded when this filter is supplied.",
example: ["COMPLETED", "ACTIVE"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
challengeStatus?: string[];
@ApiProperty({
required: false,
description:
"List of payment statuses to filter payments (for example ON_HOLD, PROCESSING, CANCELLED). If omitted, all statuses are included.",
example: ["ON_HOLD", "PROCESSING"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
status?: string[];
}
export class PaymentsReportResponse {
billingAccountId: string;
@ApiProperty({
description:
'Resolved display name from challenges."Challenge".name for challenge payments or engagements."Engagement".title for engagement payments. Null when the external reference cannot be resolved.',
nullable: true,
type: String,
})
challengeName: string | null;
@ApiProperty({
description:
"Reference from finance.winnings.external_id. This is a challenge ID for challenge payments and an engagement assignment ID for ENGAGEMENT_PAYMENT rows.",
})
challengeId: string;
@ApiProperty({
description: "Winnings category from finance.winnings.category",
})
category: string;
@ApiProperty({
description:
"Payment creation timestamp in America/New_York with its UTC offset",
example: "2026-07-31T18:53:33.383-04:00",
})
paymentDate: string;
paymentId: string;
paymentStatus: string;
winnerId: string;
winnerHandle: string;
winnerFirstName: string;
winnerLastName: string;
isTask: boolean;
challengeFee: number;
paymentAmount: number;
@ApiProperty({
description:
"Normalized challenge status label for challenge-backed payments. ENGAGEMENT_PAYMENT rows are always reported as Completed; challenge-backed rows whose external reference cannot be resolved remain null.",
nullable: true,
type: String,
})
challengeStatus: string | null;
}
export class BillingAccountProfileQueryDto {
@ApiProperty({
required: true,
description:
"Billing account identifier (matches finance.payment.billing_account and billing-accounts.BillingAccount.id)",
example: "80004349",
})
@Transform(({ value }) => (typeof value === "string" ? value.trim() : value))
@IsString()
@IsNotEmpty()
billingAccountId: string;
}
export class BillingAccountDetailResponse {
@ApiProperty()
name: string;
@ApiProperty({ nullable: true, type: String })
description: string | null;
@ApiProperty({ nullable: true, type: String })
subcontractingEndCustomer: string | null;
@ApiProperty()
status: string;
@ApiProperty({ nullable: true, type: String })
startDate: string | null;
@ApiProperty({ nullable: true, type: String })
endDate: string | null;
@ApiProperty()
budget: string;
@ApiProperty()
markup: string;
}
export class BillingAccountProfileResponse {
@ApiProperty({
nullable: true,
type: BillingAccountDetailResponse,
description:
"Row from billing-accounts.BillingAccount when the ID exists; null if unknown.",
})
billingAccount: BillingAccountDetailResponse | null;
}
export class TaasJobsReportQueryDto {
@ApiProperty({
required: false,
description: "Array of TaaS job UUIDs from taas.jobs.id",
example: ["a2bbf3e6-5d5c-4cf8-8c69-89fcd1d98d52"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
jobIds?: string[];
@ApiProperty({
required: false,
description: "Array of project IDs from taas.jobs.project_id",
example: [12345, 67890],
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false }, { each: true })
@Transform(({ value }) =>
transformArray({ value })?.map((v) => transformToNumber({ value: v })),
)
projectIds?: number[];
@ApiProperty({
required: false,
description: "Array of job statuses from taas.jobs.status",
example: ["open", "assigned"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
status?: string[];
@ApiProperty({
required: false,
description: "Array of resource types from taas.jobs.resource_type",
example: ["designer", "developer"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
resourceType?: string[];
@ApiProperty({
required: false,
description:
"Array of skill names to match against the taas.jobs.skills JSONB field",
example: ["React", "Node.js"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
skills?: string[];
@ApiProperty({
required: false,
description: "Start date (inclusive) for filtering taas.jobs.start_date",
example: "2023-01-01",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description: "End date (inclusive) for filtering taas.jobs.start_date",
example: "2023-02-01",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description: "Minimum number of positions from taas.jobs.num_positions",
example: 1,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
minPositions?: number;
@ApiProperty({
required: false,
description: "Maximum number of positions from taas.jobs.num_positions",
example: 5,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
maxPositions?: number;
}
export class TaasJobsReportResponse {
@ApiProperty({ description: "TaaS job UUID from taas.jobs.id" })
jobId: string;
@ApiProperty({ description: "Project ID from taas.jobs.project_id" })
projectId: number;
@ApiProperty({
description: "External identifier from taas.jobs.external_id",
})
externalId: string;
@ApiProperty({ description: "Job title from taas.jobs.title" })
title: string;
@ApiProperty({ description: "Job description from taas.jobs.description" })
description: string;
@ApiProperty({ description: "Job status from taas.jobs.status" })
status: string;
@ApiProperty({ description: "Resource type from taas.jobs.resource_type" })
resourceType: string;
@ApiProperty({ description: "Rate type from taas.jobs.rate_type" })
rateType: string;
@ApiProperty({ description: "Skills JSONB payload from taas.jobs.skills" })
skills: any;
@ApiProperty({
description: "Number of positions from taas.jobs.num_positions",
})
numPositions: number;
@ApiProperty({ description: "Start date from taas.jobs.start_date" })
startDate: string;
@ApiProperty({ description: "Duration from taas.jobs.duration" })
duration: number;
@ApiProperty({ description: "Workload from taas.jobs.workload" })
workload: string;
@ApiProperty({ description: "Minimum salary from taas.jobs.min_salary" })
minSalary: number;
@ApiProperty({ description: "Maximum salary from taas.jobs.max_salary" })
maxSalary: number;
@ApiProperty({ description: "Hours per week from taas.jobs.hours_per_week" })
hoursPerWeek: number;
@ApiProperty({ description: "Currency code from taas.jobs.currency" })
currency: string;
@ApiProperty({
description: "Record creation timestamp from taas.jobs.created_at",
})
createdAt: string;
@ApiProperty({
description: "Record update timestamp from taas.jobs.updated_at",
})
updatedAt: string;
}
export class TaasResourceBookingsReportQueryDto {
@ApiProperty({
required: false,
description:
"Array of resource booking UUIDs from taas.resource_bookings.id",
example: ["c2bbf3e6-5d5c-4cf8-8c69-89fcd1d98d52"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
resourceBookingIds?: string[];
@ApiProperty({
required: false,
description: "Array of job UUIDs from taas.resource_bookings.job_id",
example: ["a2bbf3e6-5d5c-4cf8-8c69-89fcd1d98d52"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
jobIds?: string[];
@ApiProperty({
required: false,
description: "Array of project IDs from taas.resource_bookings.project_id",
example: [12345],
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false }, { each: true })
@Transform(({ value }) =>
transformArray({ value })?.map((v) => transformToNumber({ value: v })),
)
projectIds?: number[];
@ApiProperty({
required: false,
description: "Array of user IDs from taas.resource_bookings.user_id",
example: ["123456"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
userIds?: string[];
@ApiProperty({
required: false,
description:
"Array of member handles (case-insensitive) joined via identity.user.handle",
example: ["user_01", "user_02"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
handles?: string[];
@ApiProperty({
required: false,
description: "Array of booking statuses from taas.resource_bookings.status",
example: ["placed", "active"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
status?: string[];
@ApiProperty({
required: false,
description:
"Array of billing account IDs from taas.resource_bookings.billing_account_id",
example: ["80001012"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
billingAccountIds?: string[];
@ApiProperty({
required: false,
description:
"Start date (inclusive) for filtering taas.resource_bookings.start_date",
example: "2023-01-01",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description:
"End date (inclusive) for filtering taas.resource_bookings.end_date",
example: "2023-02-01",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description:
"Minimum customer rate from taas.resource_bookings.customer_rate",
example: 50,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
minCustomerRate?: number;
@ApiProperty({
required: false,
description:
"Maximum customer rate from taas.resource_bookings.customer_rate",
example: 150,
})
@IsOptional()
@IsNumber({ allowNaN: false, allowInfinity: false })
@Transform(transformToNumber)
maxCustomerRate?: number;
}
export class TaasResourceBookingsReportResponse {
@ApiProperty({
description: "Resource booking UUID from taas.resource_bookings.id",
})
resourceBookingId: string;
@ApiProperty({ description: "Job UUID from taas.resource_bookings.job_id" })
jobId: string;
@ApiProperty({
description: "Project ID from taas.resource_bookings.project_id",
})
projectId: number;
@ApiProperty({ description: "User ID from taas.resource_bookings.user_id" })
userId: string;
@ApiProperty({ description: "Member handle from identity.user.handle" })
userHandle: string;
@ApiProperty({ description: "First name from identity.user.first_name" })
firstName: string;
@ApiProperty({ description: "Last name from identity.user.last_name" })
lastName: string;
@ApiProperty({
description: "Booking status from taas.resource_bookings.status",
})
status: string;
@ApiProperty({
description: "Start date from taas.resource_bookings.start_date",
})
startDate: string;
@ApiProperty({ description: "End date from taas.resource_bookings.end_date" })
endDate: string;
@ApiProperty({
description: "Member rate from taas.resource_bookings.member_rate",
})
memberRate: number;
@ApiProperty({
description: "Customer rate from taas.resource_bookings.customer_rate",
})
customerRate: number;
@ApiProperty({
description: "Rate type from taas.resource_bookings.rate_type",
})
rateType: string;
@ApiProperty({
description:
"Billing account ID from taas.resource_bookings.billing_account_id",
})
billingAccountId: string;
@ApiProperty({
description:
"Record creation timestamp from taas.resource_bookings.created_at",
})
createdAt: string;
@ApiProperty({
description:
"Record update timestamp from taas.resource_bookings.updated_at",
})
updatedAt: string;
}
export class TaasMemberVerificationReportQueryDto {
@ApiProperty({
required: true,
description:
"List of member handles to check verification status (case-insensitive)",
example: ["user1", "user2"],
})
@IsNotEmpty()
@IsString({ each: true })
@Transform(transformArray)
handles: string[];
}
export class TaasMemberVerificationReportResponse {
@ApiProperty({ description: "Member handle from identity.user.handle" })
handle: string;
@ApiProperty({ description: "User ID from identity.user.user_id" })
userId: string;
@ApiProperty({
description:
"Verification flag derived from finance.user_identity_verification_associations.verification_status",
})
verified: boolean;
@ApiProperty({ description: "Derived verification status label" })
verificationStatus: string;
}
export class WesternUnionPaymentsReportQueryDto {
@ApiProperty({
required: false,
description:
"Payment status description filter (Looker-style, default: 'Entered into payment system')",
example: "Entered into payment system",
default: "Entered into payment system",
})
@IsOptional()
@IsString()
paymentStatus?: string;
@ApiProperty({
required: false,
description:
"Payment method filter matched against finance.payment_method name/type (default: 'Western Union')",
example: "Western Union",
default: "Western Union",
})
@IsOptional()
@IsString()
paymentMethod?: string;
@ApiProperty({
required: false,
description:
"Start date for filtering payment created_at in ISO 8601 format",
example: "2023-01-01",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description: "End date for filtering payment created_at in ISO 8601 format",
example: "2023-01-31",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description: "Array of member handles to filter payments",
example: ["user1", "user2"],
})
@IsOptional()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
handles?: string[];
}
export class WesternUnionPaymentsReportResponse {
@ApiProperty({ description: "Payment ID from finance.payment.payment_id" })
paymentId: string;
@ApiProperty({ description: "Member handle from identity.user.handle" })
handle: string;
@ApiProperty({
description: "Gross amount from finance.payment.gross_amount",
})
grossAmount: number;
@ApiProperty({
description:
"Reference ID from finance.winnings.external_id (challenge reference)",
})
referenceId: string;
@ApiProperty({
description: "Payment description from finance.winnings.title/description",
})
description: string;
@ApiProperty({
description:
"Payment status description mapped from finance.payment.payment_status",
})
paymentStatus: string;
@ApiProperty({ description: "Payment date from finance.payment.created_at" })
paymentDate: string;
}
export class BaFeesReportQueryDto {
@ApiProperty({
required: false,
description:
"Array of billing account IDs to include or exclude (prefix with ! to exclude). Use exclusion to drop Topgear data when you want to mirror the Salesforce importTopgearData() behavior (for example !<TopgearBAId>).",
example: ["12345", "!67890"],
})
@IsOptional()
@IsArray()
@IsString({ each: true })
@IsNotEmpty({ each: true })
@Transform(transformArray)
billingAccountIds?: string[];
@ApiProperty({
required: false,
description:
"Start date (inclusive from the start of the America/New_York calendar day) for the report query in YYYY-MM-DD format. For accepted ISO timestamps, only the written calendar-date portion is used. If omitted the report uses an open-ended lower bound.",
example: "2023-01-01",
})
@IsOptional()
@IsDateString()
startDate?: string;
@ApiProperty({
required: false,
description:
"End date (inclusive through the full America/New_York calendar day) for the report query in YYYY-MM-DD format. For accepted ISO timestamps, only the written calendar-date portion is used",
example: "2023-01-31",
})
@IsOptional()
@IsDateString()
endDate?: string;
@ApiProperty({
required: false,
description: "Aggregation level for the report",
enum: ["total", "month"],
example: "month",
default: "total",
})
@IsOptional()
@IsIn(["total", "month"])
groupBy?: "total" | "month";
}
export class BaFeesReportResponse {
@ApiProperty({
description:
"Billing account identifier returned from finance.payment.billing_account",
example: "80001012",
})
billingAccountId: string;
@ApiProperty({
description:
"Total challenge fees summed from finance.payment.challenge_fee for the filtered billing account",
example: 1200.5,
})
totalFees: number;
@ApiProperty({
description:
"Total member payments summed from finance.payment.total_amount for the filtered billing account",
example: 980.75,
})
totalMemberPayments: number;
@ApiProperty({
description:
"Most recent payment status for the billing account derived from finance.payment.payment_status (values include Entered into payment system, On hold, On hold - admin, Owed, Paid, Cancelled, Failed, Returned, or the raw payment_status code)",
example: "Paid",
})
currentPaymentStatus: string;
@ApiProperty({
required: false,
description: "Month bucket (YYYY-MM) when groupBy is set to month",
example: "2024-01",
})
month?: string;
@ApiProperty({
required: false,
description:
"Number of payments contributing to the bucket when groupBy=month",
example: 42,
})
paymentCount?: number;
@ApiProperty({
required: false,
description: "Earliest payment date in the bucket when groupBy=month",
example: "2024-01-02",
})
earliestPaymentDate?: string;
@ApiProperty({
required: false,
description: "Latest payment date in the bucket when groupBy=month",
example: "2024-01-31",
})
latestPaymentDate?: string;
}