Files
TREK/server/src/nest/settings/settings.dto.ts
T
jubnl e0530680cb feat(server): adopt zod DTOs for the settings body contracts
SettingUpsertDto/SettingsBulkDto wrap the existing @trek/shared schemas; both
SettingsController entries drop off the body-contract allow-list (boot
ratchet). Per the todo precedent the dead bespoke 400 guards go: missing/empty
key and a non-record settings body now answer with the pipe envelope
({ error: 'key: …' } / { error: 'settings: …' }) instead of 'Key is required' /
'Settings object is required', and arrays for settings are rejected. The local
masked-value literal now imports MASKED_SETTING_VALUE from @trek/shared.
The settings e2e registers ZodValidationPipe and pins the DTO 400s plus the
bulk masked-sentinel skip.
2026-07-26 22:24:14 +02:00

12 lines
609 B
TypeScript

import { createZodDto } from 'nestjs-zod';
import { settingUpsertRequestSchema, settingsBulkRequestSchema } from '@trek/shared';
/**
* Server-side createZodDto wrappers over the @trek/shared settings contracts.
* The global ZodValidationPipe (APP_PIPE in app.module.ts) validates any
* @Body() parameter typed with one of these classes by metatype — the Zod
* schemas in shared/ remain the single source of truth for the wire contract.
*/
export class SettingUpsertDto extends createZodDto(settingUpsertRequestSchema) {}
export class SettingsBulkDto extends createZodDto(settingsBulkRequestSchema) {}