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

120 lines
2.1 KiB
TypeScript
Raw Normal View History

import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { AuthSys } from "./AuthSys";
import { AuthRole } from "./AuthRole";
2024-06-11 13:19:38 +07:00
@Entity("authRoleAttr")
export class AuthRoleAttr extends EntityBase {
@Column({
nullable: true,
comment: "",
length: 255,
default: null,
})
attrOwnership: string;
@Column({
comment: "",
default: false,
})
attrIsCreate: boolean;
@Column({
comment: "",
default: false,
})
attrIsList: boolean;
@Column({
comment: "",
default: false,
})
attrIsGet: boolean;
@Column({
comment: "",
default: false,
})
attrIsUpdate: boolean;
@Column({
comment: "",
default: false,
})
attrIsDelete: boolean;
@Column({
nullable: true,
comment: "",
length: 255,
default: null,
})
attrPrivilege: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง AuthRole",
default: null,
})
authRoleId: string;
@Column({
nullable: true,
length: 255,
comment: "คีย์นอก(FK)ของตาราง AuthSys",
default: null,
})
authSysId: string;
2024-06-12 10:11:13 +07:00
@Column({
nullable: true,
length: 255,
comment: "Root",
default: null,
})
parentNode?: string;
2024-06-12 10:11:13 +07:00
2024-06-12 10:50:07 +07:00
// @ManyToOne(() => AuthSys, (authSys) => authSys.authSys)
// @JoinColumn({ name: "authSysId" })
// authRoleAttrForSys: AuthSys;
@ManyToOne(() => AuthRole, (authRole) => authRole.authRoles)
@JoinColumn({ name: "authRoleId" })
authRoleAttrForRole: AuthRole;
}
export class CreateAuthRoleAttr {
@Column()
attrOwnership: string;
@Column()
attrIsCreate: boolean;
@Column()
attrIsList: boolean;
@Column()
attrIsGet: boolean;
@Column()
attrIsUpdate: boolean;
@Column()
attrIsDelete: boolean;
@Column()
attrPrivilege: string;
2024-06-11 15:03:53 +07:00
@Column("uuid")
authRoleId: string;
@Column("uuid")
authSysId: string;
2024-06-12 10:11:13 +07:00
@Column()
parentNode?: string | null;
}
export type UpdateAuthRoleAttr = Partial<CreateAuthRoleAttr>;