shared: source de vérité unique pour les énums d'API
- API_STATUSES inclut 'NO_YAML' (était manquant alors que le type et le code l'utilisent) - ApiType/ApiStatus/ApiConvention dérivés des constantes (typeof X[number]) -> plus de double maintenance type <-> tableau - DTO back réutilisent API_CONVENTIONS/API_TYPES dans @IsIn (fin de la triple duplication des valeurs) - front: déclare la dépendance @datacat/shared (workspace:*) - shared: exports map + métadonnées + README (double build front/back) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { IsString, IsNotEmpty, IsIn, IsOptional, IsUUID, IsInt, Min, IsEmail } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ApiType, ApiConvention } from '@datacat/shared';
|
||||
import { ApiType, ApiConvention, API_CONVENTIONS, API_TYPES } from '@datacat/shared';
|
||||
|
||||
export class CreateApiEntryDto {
|
||||
@IsIn(['CONSULTER', 'ENREGISTRER', 'ETRE_NOTIFIE'])
|
||||
@IsIn([...API_CONVENTIONS])
|
||||
convention!: ApiConvention;
|
||||
|
||||
@IsString()
|
||||
@@ -33,7 +33,7 @@ export class CreateApiEntryDto {
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
@IsIn(['ASYNCAPI', 'OPENAPI'])
|
||||
@IsIn([...API_TYPES])
|
||||
type!: ApiType;
|
||||
|
||||
@IsString()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { IsString, IsOptional, IsUUID, IsIn, IsInt, Min, IsEmail } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ApiConvention } from '@datacat/shared';
|
||||
import { ApiConvention, API_CONVENTIONS } from '@datacat/shared';
|
||||
|
||||
export class UpdateApiEntryDto {
|
||||
@IsIn(['CONSULTER', 'ENREGISTRER', 'ETRE_NOTIFIE'])
|
||||
@IsIn([...API_CONVENTIONS])
|
||||
@IsOptional()
|
||||
convention?: ApiConvention;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user