Fix review findings for info broker removal service FRE-5402

P0 fixes:
- Add CANCELLED status to RemovalStatus enum (types + Prisma schema)
- Use CANCELLED instead of REJECTED for user-initiated cancellations
- Add null guard for req.broker?.name in GET /request/:id
- Remove unsafe 'as any' casts in RemoveBrokersService.ts
- Add type-safe toPersonalInfo() validator for JSON deserialization
- Type RemovalRequestWithBroker properly in getRemovalStatus()
- Fix alert: any to NormalizedAlertInput in BrokerAlertPipeline

P1 fixes:
- Fix admin role check: remove non-existent 'admin', only check 'support'
- Fix BrokerDefinition.category type from string to BrokerCategory
- Add complete OpenAPI spec for all removebrokers routes and schemas
This commit is contained in:
2026-05-17 02:30:00 -04:00
parent e9e547be78
commit 7410813f4e
6 changed files with 3673 additions and 11 deletions

View File

@@ -399,6 +399,7 @@ export const RemovalStatus = {
COMPLETED: "COMPLETED",
FAILED: "FAILED",
REJECTED: "REJECTED",
CANCELLED: "CANCELLED",
} as const;
export type RemovalStatus = (typeof RemovalStatus)[keyof typeof RemovalStatus];
@@ -416,7 +417,7 @@ export interface BrokerDefinition {
id: string;
name: string;
domain: string;
category: string;
category: BrokerCategory;
removalMethod: RemovalMethod;
removalUrl?: string;
requiresAccount: boolean;