260316:1117 20260316:1100 Refactor UUID
Build and Deploy / deploy (push) Successful in 9m24s

This commit is contained in:
admin
2026-03-16 11:17:15 +07:00
parent b93cd91325
commit c5c3ed9016
92 changed files with 1726 additions and 620 deletions
@@ -0,0 +1,20 @@
import { PipeTransform, Injectable, BadRequestException } from '@nestjs/common';
import { validate as uuidValidate } from 'uuid';
/**
* Validates that a route parameter is a valid UUID string.
* Accepts any UUID version (v1 from DB DEFAULT, v7 from app generation).
*
* Usage: @Param('uuid', ParseUuidPipe) uuid: string
*
* @see ADR-019 Hybrid Identifier Strategy
*/
@Injectable()
export class ParseUuidPipe implements PipeTransform<string> {
transform(value: string): string {
if (!uuidValidate(value)) {
throw new BadRequestException(`Invalid UUID format: ${value}`);
}
return value.toLowerCase();
}
}