diff --git a/src/notes/note-permissions.dto.ts b/src/notes/note-permissions.dto.ts index 753344c91..43e8e728d 100644 --- a/src/notes/note-permissions.dto.ts +++ b/src/notes/note-permissions.dto.ts @@ -52,11 +52,11 @@ export class NoteUserPermissionUpdateDto { export class NoteGroupPermissionEntryDto { /** - * Group this permission applies to + * Name of the Group this permission applies to */ - @ValidateNested() - @ApiProperty({ type: GroupInfoDto }) - group: GroupInfoDto; + @IsString() + @ApiProperty() + groupName: string; /** * True if the group members are allowed to edit the note diff --git a/src/notes/notes.service.spec.ts b/src/notes/notes.service.spec.ts index 17f7a072f..66f923099 100644 --- a/src/notes/notes.service.spec.ts +++ b/src/notes/notes.service.spec.ts @@ -691,7 +691,7 @@ describe('NotesService', () => { expect(permissions.sharedToUsers[0].username).toEqual(user.username); expect(permissions.sharedToUsers[0].canEdit).toEqual(true); expect(permissions.sharedToGroups).toHaveLength(1); - expect(permissions.sharedToGroups[0].group.displayName).toEqual( + expect(permissions.sharedToGroups[0].groupName).toEqual( group.displayName, ); expect(permissions.sharedToGroups[0].canEdit).toEqual(true); @@ -783,9 +783,9 @@ describe('NotesService', () => { ); expect(metadataDto.permissions.sharedToUsers[0].canEdit).toEqual(true); expect(metadataDto.permissions.sharedToGroups).toHaveLength(1); - expect( - metadataDto.permissions.sharedToGroups[0].group.displayName, - ).toEqual(group.displayName); + expect(metadataDto.permissions.sharedToGroups[0].groupName).toEqual( + group.displayName, + ); expect(metadataDto.permissions.sharedToGroups[0].canEdit).toEqual(true); expect(metadataDto.tags).toHaveLength(1); expect(metadataDto.tags[0]).toEqual((await note.tags)[0].name); @@ -887,9 +887,9 @@ describe('NotesService', () => { true, ); expect(noteDto.metadata.permissions.sharedToGroups).toHaveLength(1); - expect( - noteDto.metadata.permissions.sharedToGroups[0].group.displayName, - ).toEqual(group.displayName); + expect(noteDto.metadata.permissions.sharedToGroups[0].groupName).toEqual( + group.displayName, + ); expect(noteDto.metadata.permissions.sharedToGroups[0].canEdit).toEqual( true, ); diff --git a/src/notes/notes.service.ts b/src/notes/notes.service.ts index e89730eea..fdfd37116 100644 --- a/src/notes/notes.service.ts +++ b/src/notes/notes.service.ts @@ -379,7 +379,7 @@ export class NotesService { canEdit: noteUserPermission.canEdit, })), sharedToGroups: groupPermissions.map((noteGroupPermission) => ({ - group: this.groupsService.toGroupDto(noteGroupPermission.group), + groupName: noteGroupPermission.group.name, canEdit: noteGroupPermission.canEdit, })), };