mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
Permissions: Add cascade
This makes it possible to create permissions by setting them in the note entity and delete them when either the user or note is deleted. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
aa41bebbf0
commit
979154b8a5
3 changed files with 22 additions and 5 deletions
|
@ -10,10 +10,16 @@ import { Note } from '../notes/note.entity';
|
|||
|
||||
@Entity()
|
||||
export class NoteGroupPermission {
|
||||
@ManyToOne((_) => Group, { primary: true })
|
||||
@ManyToOne((_) => Group, {
|
||||
primary: true,
|
||||
onDelete: 'CASCADE', // This deletes the NoteGroupPermission, when the associated Group is deleted
|
||||
})
|
||||
group: Group;
|
||||
|
||||
@ManyToOne((_) => Note, (note) => note.groupPermissions, { primary: true })
|
||||
@ManyToOne((_) => Note, (note) => note.groupPermissions, {
|
||||
primary: true,
|
||||
onDelete: 'CASCADE', // This deletes the NoteGroupPermission, when the associated Note is deleted
|
||||
})
|
||||
note: Note;
|
||||
|
||||
@Column()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue