Changement sur le Readme
Ajout d'une partie spécifique pour des PNJ dans la partie campagne
This commit is contained in:
@@ -41,7 +41,7 @@ export type ChatStreamEvent =
|
||||
* décode ligne par ligne pour extraire les événements SSE.
|
||||
*/
|
||||
/** Type d'entité narrative focus pour le chat Campagne. */
|
||||
export type NarrativeEntityType = 'arc' | 'chapter' | 'scene' | 'character';
|
||||
export type NarrativeEntityType = 'arc' | 'chapter' | 'scene' | 'character' | 'npc';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AiChatService {
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface Conversation {
|
||||
export interface ConversationContext {
|
||||
loreId?: string | null;
|
||||
campaignId?: string | null;
|
||||
entityType?: 'page' | 'arc' | 'chapter' | 'scene' | 'character' | null;
|
||||
entityType?: 'page' | 'arc' | 'chapter' | 'scene' | 'character' | 'npc' | null;
|
||||
entityId?: string | null;
|
||||
}
|
||||
|
||||
|
||||
18
web/src/app/services/npc.model.ts
Normal file
18
web/src/app/services/npc.model.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Fiche de personnage non-joueur (PNJ) d'une campagne.
|
||||
* MVP : markdownContent libre (description, motivation, stats, notes MJ).
|
||||
* Évolution prévue : templating partagé PJ/PNJ piloté par GameSystem.
|
||||
*/
|
||||
export interface Npc {
|
||||
id?: string;
|
||||
name: string;
|
||||
markdownContent?: string | null;
|
||||
campaignId: string;
|
||||
order?: number;
|
||||
}
|
||||
|
||||
export interface NpcCreate {
|
||||
name: string;
|
||||
markdownContent?: string | null;
|
||||
campaignId: string;
|
||||
}
|
||||
34
web/src/app/services/npc.service.ts
Normal file
34
web/src/app/services/npc.service.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Npc, NpcCreate } from './npc.model';
|
||||
|
||||
/**
|
||||
* Service HTTP pour les fiches de PNJ d'une campagne.
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class NpcService {
|
||||
private apiUrl = '/api/npcs';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getByCampaign(campaignId: string): Observable<Npc[]> {
|
||||
return this.http.get<Npc[]>(`${this.apiUrl}/campaign/${campaignId}`);
|
||||
}
|
||||
|
||||
getById(id: string): Observable<Npc> {
|
||||
return this.http.get<Npc>(`${this.apiUrl}/${id}`);
|
||||
}
|
||||
|
||||
create(payload: NpcCreate): Observable<Npc> {
|
||||
return this.http.post<Npc>(this.apiUrl, payload);
|
||||
}
|
||||
|
||||
update(id: string, payload: Npc): Observable<Npc> {
|
||||
return this.http.put<Npc>(`${this.apiUrl}/${id}`, payload);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`${this.apiUrl}/${id}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user