File tree Expand file tree Collapse file tree 4 files changed +44
-20
lines changed Expand file tree Collapse file tree 4 files changed +44
-20
lines changed Original file line number Diff line number Diff line change @@ -574,16 +574,14 @@ export function adaptPivotObject(dto: PivotObjectDto): PivotObject {
574
574
575
575
export type CaseReview = {
576
576
output : string ;
577
- sanityCheck : string ;
578
- thought : string ;
579
- ok : boolean ;
580
- } ;
577
+ thought ?: string ;
578
+ } & ( { ok : true ; sanityCheck ?: undefined } | { ok : false ; sanityCheck : string } ) ;
581
579
582
580
export function adaptCaseReview ( dto : CaseReviewDto ) : CaseReview {
583
- return {
584
- output : dto . output ,
585
- sanityCheck : dto . sanity_check ,
586
- thought : dto . thought ,
587
- ok : dto . ok ,
588
- } ;
581
+ const baseCaseReview = { output : dto . output , thought : dto . thought } as const ;
582
+
583
+ if ( ! dto . ok ) {
584
+ return { ... baseCaseReview , ok : false , sanityCheck : dto . sanity_check } ;
585
+ }
586
+ return { ... baseCaseReview , ok : true } ;
589
587
}
Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ PivotObjectDto:
131
131
$ref : cases.yml#/components/schemas/PivotObjectDto
132
132
CaseReviewDto :
133
133
$ref : cases.yml#/components/schemas/CaseReviewDto
134
+ CaseReviewOkDto :
135
+ $ref : cases.yml#/components/schemas/CaseReviewOkDto
136
+ CaseReviewNotOkDto :
137
+ $ref : cases.yml#/components/schemas/CaseReviewNotOkDto
134
138
135
139
# SUSPICIOUS ACTIVITY REPORTS
136
140
Original file line number Diff line number Diff line change @@ -1359,18 +1359,35 @@ components:
1359
1359
- pivot_object_data
1360
1360
- number_of_decisions
1361
1361
CaseReviewDto :
1362
+ allOf :
1363
+ - type : object
1364
+ required :
1365
+ - output
1366
+ properties :
1367
+ output :
1368
+ type : string
1369
+ thought :
1370
+ type : string
1371
+ - anyOf :
1372
+ - $ref : ' #/components/schemas/CaseReviewOkDto'
1373
+ - $ref : ' #/components/schemas/CaseReviewNotOkDto'
1374
+
1375
+ CaseReviewOkDto :
1376
+ type : object
1377
+ required :
1378
+ - ok
1379
+ properties :
1380
+ ok :
1381
+ type : boolean
1382
+ enum : [true]
1383
+ CaseReviewNotOkDto :
1362
1384
type : object
1363
1385
required :
1364
1386
- ok
1365
- - output
1366
1387
- sanity_check
1367
- - thought
1368
1388
properties :
1369
1389
ok :
1370
1390
type : boolean
1371
- output :
1372
- type : string
1391
+ enum : [false]
1373
1392
sanity_check :
1374
1393
type : string
1375
- thought :
1376
- type : string
Original file line number Diff line number Diff line change @@ -425,12 +425,17 @@ export type PivotObjectDto = {
425
425
export type NextCaseIdDto = {
426
426
id : string ;
427
427
} ;
428
- export type CaseReviewDto = {
429
- ok : boolean ;
430
- output : string ;
428
+ export type CaseReviewOkDto = {
429
+ ok : true ;
430
+ } ;
431
+ export type CaseReviewNotOkDto = {
432
+ ok : false ;
431
433
sanity_check : string ;
432
- thought : string ;
433
434
} ;
435
+ export type CaseReviewDto = {
436
+ output : string ;
437
+ thought ?: string ;
438
+ } & ( CaseReviewOkDto | CaseReviewNotOkDto ) ;
434
439
export type SuspiciousActivityReportDto = {
435
440
id : string ;
436
441
status : "pending" | "completed" ;
You can’t perform that action at this time.
0 commit comments