mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 00:54:43 -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
f3d53a687b
commit
029dc0d7d6
3 changed files with 22 additions and 5 deletions
|
@ -10,10 +10,16 @@ import { User } from '../users/user.entity';
|
|||
|
||||
@Entity()
|
||||
export class NoteUserPermission {
|
||||
@ManyToOne((_) => User, { primary: true })
|
||||
@ManyToOne((_) => User, {
|
||||
primary: true,
|
||||
onDelete: 'CASCADE', // This deletes the NoteUserPermission, when the associated Note is deleted
|
||||
})
|
||||
user: User;
|
||||
|
||||
@ManyToOne((_) => Note, (note) => note.userPermissions, { primary: true })
|
||||
@ManyToOne((_) => Note, (note) => note.userPermissions, {
|
||||
primary: true,
|
||||
onDelete: 'CASCADE', // This deletes the NoteUserPermission, when the associated Note is deleted
|
||||
})
|
||||
note: Note;
|
||||
|
||||
@Column()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue