mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
e0530680cb
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.
12 lines
609 B
TypeScript
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) {}
|