2024-09-01 14:55:05 +02:00
|
|
|
import { Column, Entity, JoinTable, ManyToMany, OneToMany, PrimaryColumn } from "typeorm";
|
2024-08-27 17:54:59 +02:00
|
|
|
import { role } from "./role";
|
2024-09-01 14:55:05 +02:00
|
|
|
import { userPermission } from "./user_permission";
|
2024-08-22 11:40:31 +02:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class user {
|
|
|
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
|
|
|
id: number;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
mail: string;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
username: string;
|
|
|
|
|
2024-08-25 13:36:19 +02:00
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
firstname: string;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
lastname: string;
|
|
|
|
|
2024-08-22 11:40:31 +02:00
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
secret: string;
|
2024-08-27 17:54:59 +02:00
|
|
|
|
|
|
|
@ManyToMany(() => role, (role) => role.users)
|
|
|
|
@JoinTable({
|
|
|
|
name: "user_roles",
|
|
|
|
})
|
|
|
|
roles: role[];
|
2024-09-01 14:55:05 +02:00
|
|
|
|
|
|
|
@OneToMany(() => userPermission, (userPermission) => userPermission.user)
|
|
|
|
permissions: userPermission[];
|
2024-08-22 11:40:31 +02:00
|
|
|
}
|