add entity AuthRole , AuthRoleAttr , AuthSys

This commit is contained in:
AdisakKanthawilang 2024-06-11 11:22:59 +07:00
parent aa67674fa7
commit 4beef77eb3
3 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,102 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { AuthSys } from "./AuthSys";
import { AuthRole } from "./AuthRole";
@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;
@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;
}
export type UpdateAuthRoleAttr = Partial<CreateAuthRoleAttr>;