Amélioration de l'IA pour la partie atelier PDF
Mise en place d'un outil permettant de faire des tableau d'objets pour des boutiques par exemple
This commit is contained in:
26
web/src/app/services/item-catalog.model.ts
Normal file
26
web/src/app/services/item-catalog.model.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/** Reflet de l'ItemCatalogDTO côté Core. Un catalogue d'objets (boutique, butin…). */
|
||||
|
||||
export interface CatalogItem {
|
||||
name: string;
|
||||
price?: string;
|
||||
category?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface ItemCatalog {
|
||||
id?: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
campaignId: string;
|
||||
order?: number;
|
||||
items: CatalogItem[];
|
||||
}
|
||||
|
||||
export interface ItemCatalogCreate {
|
||||
name: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
campaignId: string;
|
||||
items: CatalogItem[];
|
||||
}
|
||||
39
web/src/app/services/item-catalog.service.ts
Normal file
39
web/src/app/services/item-catalog.service.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ItemCatalog, ItemCatalogCreate } from './item-catalog.model';
|
||||
|
||||
/**
|
||||
* CRUD des catalogues d'objets (campagne) + génération IA. Mirroir de RandomTableService.
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ItemCatalogService {
|
||||
private apiUrl = '/api/item-catalogs';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getByCampaign(campaignId: string): Observable<ItemCatalog[]> {
|
||||
return this.http.get<ItemCatalog[]>(`${this.apiUrl}/campaign/${campaignId}`);
|
||||
}
|
||||
|
||||
getById(id: string): Observable<ItemCatalog> {
|
||||
return this.http.get<ItemCatalog>(`${this.apiUrl}/${id}`);
|
||||
}
|
||||
|
||||
create(payload: ItemCatalogCreate): Observable<ItemCatalog> {
|
||||
return this.http.post<ItemCatalog>(this.apiUrl, payload);
|
||||
}
|
||||
|
||||
update(id: string, payload: ItemCatalog): Observable<ItemCatalog> {
|
||||
return this.http.put<ItemCatalog>(`${this.apiUrl}/${id}`, payload);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`${this.apiUrl}/${id}`);
|
||||
}
|
||||
|
||||
/** Génère une PROPOSITION de catalogue via l'IA (non persistée) à préremplir. */
|
||||
generate(campaignId: string, description: string): Observable<ItemCatalog> {
|
||||
return this.http.post<ItemCatalog>(`${this.apiUrl}/generate`, { campaignId, description });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user