mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Add relation between User and Group
This represents the users which are members of this group Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
910f634b5f
commit
f8e07f6940
12 changed files with 103 additions and 16 deletions
|
@ -4,7 +4,14 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
@Entity()
|
||||
export class Group {
|
||||
|
@ -26,4 +33,11 @@ export class Group {
|
|||
*/
|
||||
@Column()
|
||||
special: boolean;
|
||||
|
||||
@ManyToMany((_) => User, (user) => user.groups, {
|
||||
eager: true,
|
||||
cascade: true,
|
||||
})
|
||||
@JoinTable()
|
||||
members: User[];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue