Files
listify/listify-client/src/app/lists/lists.models.ts
Bastian Wagner cb938d3dc8 Vorschläge
2026-06-15 09:44:59 +02:00

97 lines
1.9 KiB
TypeScript

import { ListTemplateKind } from '../templates/templates.models';
export interface UserListItem {
id: string;
sourceTemplateItemId?: string;
title: string;
notes?: string;
quantity?: number;
required: boolean;
checked: boolean;
checkedAt?: string;
checkedByUserId?: string;
checkedByName?: string;
position: number;
createdAt: string;
updatedAt: string;
}
export type UserListAccessRole = 'owner' | 'collaborator';
export interface UserListCollaborator {
id: string;
name?: string;
email: string;
role: 'collaborator';
}
export interface UserList {
id: string;
ownerId: string;
ownerName?: string;
ownerEmail?: string;
accessRole: UserListAccessRole;
sourceTemplateId?: string;
name: string;
description?: string;
kind: ListTemplateKind;
items: UserListItem[];
collaborators: UserListCollaborator[];
createdAt: string;
updatedAt: string;
}
export interface CreateListRequest {
name: string;
description?: string;
kind?: ListTemplateKind;
}
export interface UpdateListRequest {
name?: string;
description?: string;
kind?: ListTemplateKind;
}
export interface AddListItemRequest {
title: string;
notes?: string;
quantity?: number;
required?: boolean;
}
export interface ListItemSuggestion {
title: string;
notes?: string;
quantity?: number;
required: boolean;
}
export interface ListItemSuggestionsResponse {
suggestions: ListItemSuggestion[];
}
export interface UpdateListItemRequest {
title?: string;
notes?: string;
quantity?: number;
required?: boolean;
checked?: boolean;
}
// Wire contract for /api/lists/events. Keep this in sync with the API
// ListRealtimeEvent type; consumers should ignore unknown event types.
export type ListRealtimeEvent =
| {
type: 'list.snapshot';
data: UserList;
}
| {
type: 'list.deleted';
data: { listId: string };
}
| {
type: 'heartbeat';
data: { at: string };
};