NotesService: Set Permissions

Set the necessary information for the permissions to be correctly inserted into the db.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-03-17 10:27:29 +01:00 committed by David Mehren
parent 979154b8a5
commit 305a3f1bea
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -224,6 +224,8 @@ export class NotesService {
//TODO: Calculate patch
revisions.push(Revision.create(noteContent, noteContent));
note.revisions = Promise.resolve(revisions);
note.userPermissions = [];
note.groupPermissions = [];
return await this.noteRepository.save(note);
}
@ -270,6 +272,7 @@ export class NotesService {
user,
newUserPermission.canEdit,
);
createdPermission.note = note;
note.userPermissions.push(createdPermission);
}
@ -282,6 +285,7 @@ export class NotesService {
group,
newGroupPermission.canEdit,
);
createdPermission.note = note;
note.groupPermissions.push(createdPermission);
}