feat(status): ajouter statut NO_YAML pour les entrées sans fichier YAML

- shared: ajoute 'NO_YAML' à ApiStatus
- back/apis: status initial dérivé de yamlContent (PENDING si YAML, NO_YAML sinon)
- back/uploads: supprime la contrainte "fichier requis", gère le cas sans fichier
- front/api-detail: badgeClass/statusLabel gèrent NO_YAML (badge warning "Sans fichier")
- front/catalog: badgeClass ajoute le case NO_YAML → badge warning
- front/upload: fichier optionnel (canProceedFromStep1 retourne true si 0 fichier)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
z3n
2026-06-24 08:23:03 +00:00
parent f326efb7b0
commit 3836db1e1f
6 changed files with 34 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ export class ApisService {
description: dto.description ?? null,
type: dto.type,
yamlContent: dto.yamlContent,
status: 'PENDING',
status: dto.yamlContent ? 'PENDING' : 'NO_YAML',
categoryId: dto.categoryId ?? null,
isCurrent,
contactFunctionalName: dto.contactFunctionalName,

View File

@@ -205,7 +205,6 @@ export class UploadsController {
contactTechnicalEmail: string;
},
) {
if (!files || files.length === 0) throw new BadRequestException('YAML file is required');
if (!body.name) throw new BadRequestException('name is required');
if (!body.convention) throw new BadRequestException('convention is required');
@@ -218,7 +217,10 @@ export class UploadsController {
let yamlContent: string;
let detectedType: ApiType | null = null;
if (files.length === 1) {
if (!files || files.length === 0) {
/* Pas de fichier : entrée créée sans YAML (YAML pourra être ajouté plus tard) */
yamlContent = '';
} else if (files.length === 1) {
/* Cas simple : un seul fichier */
yamlContent = fs.readFileSync(files[0].path, 'utf-8');
@@ -260,8 +262,10 @@ export class UploadsController {
contactTechnicalEmail: body.contactTechnicalEmail,
});
/* Fire-and-forget : génération asynchrone */
this.docsService.generate(entry.id).catch(console.error);
/* Fire-and-forget : génération asynchrone (seulement si YAML fourni) */
if (yamlContent) {
this.docsService.generate(entry.id).catch(console.error);
}
return entry;
}