template sharing

This commit is contained in:
Bastian Wagner
2026-06-18 11:18:10 +02:00
parent f77a592fc8
commit 85a43d1b08
20 changed files with 714 additions and 38 deletions

View File

@@ -259,8 +259,10 @@ describe('ListsService', () => {
const template: ListTemplate = {
id: 'template-1',
ownerId: 'user-1',
accessRole: 'owner',
name: 'Urlaub',
kind: 'packing',
collaborators: [],
items: [
{
id: 'template-item-1',

View File

@@ -135,10 +135,6 @@ export class ListsService {
template: ListTemplate,
createDto: CreateListFromTemplateDto = {},
): Promise<UserList> {
if (template.ownerId !== ownerId) {
throw new ForbiddenException('List template belongs to another user.');
}
const list = this.listsRepository.create({
id: randomUUID(),
ownerId,
@@ -876,6 +872,9 @@ export class ListsService {
return {
id: template.id,
ownerId: template.ownerId,
ownerName: undefined,
ownerEmail: undefined,
accessRole: 'owner',
name: template.name,
description: template.description ?? undefined,
kind: template.kind,
@@ -891,6 +890,7 @@ export class ListsService {
createdAt: this.toIsoString(item.createdAt),
updatedAt: this.toIsoString(item.updatedAt),
})),
collaborators: [],
createdAt: this.toIsoString(template.createdAt),
updatedAt: this.toIsoString(template.updatedAt),
};