list suggestions

This commit is contained in:
Bastian Wagner
2026-06-15 14:42:58 +02:00
parent b979a3b097
commit 3998923693
10 changed files with 204 additions and 100 deletions

View File

@@ -5,6 +5,7 @@ import { of, tap, throwError } from 'rxjs';
import {
AddListItemRequest,
CreateListRequest,
CreateListWithItemSuggestionsResponse,
ListItemSuggestionsResponse,
UpdateListItemRequest,
UpdateListRequest,
@@ -59,6 +60,23 @@ export class ListsService {
return this.http.post<UserList>(this.apiUrl, data);
}
createListWithItemSuggestions(
data: CreateListRequest,
): Observable<CreateListWithItemSuggestionsResponse> {
if (!this.onlineStatus.online()) {
return throwError(
() => new Error('Listen mit KI koennen nur online erstellt werden.'),
);
}
return this.http
.post<CreateListWithItemSuggestionsResponse>(
`${this.apiUrl}/with-item-suggestions`,
data,
)
.pipe(tap((response) => this.upsertCachedList(response.list)));
}
updateList(listId: string, data: UpdateListRequest): Observable<UserList> {
if (!this.onlineStatus.online()) {
const updatedList = this.updateCachedList(listId, (list) => ({