change user model to login routine

This commit is contained in:
Julian Krauser 2025-05-03 09:09:52 +02:00
parent c35b99e0c4
commit 03a5bb3592
5 changed files with 56 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import { Column, Entity, JoinTable, ManyToMany, OneToMany, PrimaryColumn } from "typeorm";
import { role } from "./role";
import { userPermission } from "./user_permission";
import { LoginRoutineEnum } from "../../enums/loginRoutineEnum";
@Entity()
export class user {
@ -19,11 +20,23 @@ export class user {
@Column({ type: "varchar", length: 255 })
lastname: string;
@Column({ type: "varchar", length: 255 })
@Column({ type: "text", select: false })
secret: string;
@Column({ type: "boolean", default: false })
static: boolean;
@Column({
type: "varchar",
length: "255",
default: LoginRoutineEnum.totp,
transformer: {
to(value: LoginRoutineEnum) {
return value.toString();
},
from(value: string) {
return LoginRoutineEnum[value as keyof typeof LoginRoutineEnum];
},
},
})
routine: LoginRoutineEnum;
@Column({ type: "boolean", default: false })
isOwner: boolean;