template sharing
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user