hrms-api-org/src/entities/AuthRole.ts

40 lines
908 B
TypeScript
Raw Normal View History

2024-06-13 14:18:20 +07:00
import { Entity, Column, OneToMany, OneToOne } from "typeorm";
import { EntityBase } from "./base/Base";
import { AuthRoleAttr } from "./AuthRoleAttr";
2024-06-13 14:18:20 +07:00
import { PosMaster } from "./PosMaster";
2024-06-11 13:19:38 +07:00
@Entity("authRole")
export class AuthRole extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อบทบาท",
length: 255,
default: null,
})
roleName: string;
@Column({
nullable: true,
comment: "รายละเอียด",
length: 255,
default: null,
})
roleDescription: string;
@OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForRole)
authRoles: AuthRoleAttr[];
2024-06-13 14:18:20 +07:00
@OneToOne(() => PosMaster, (posMaster) => posMaster.authRole)
posMaster: PosMaster;
}
export class CreateAuthRole {
@Column()
roleName: string;
@Column()
roleDescription: string;
}
export type UpdateAuthRole = Partial<CreateAuthRole>;