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

27 lines
776 B
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { Profile } from "./Profile";
@Entity("permissionOrg")
export class PermissionOrg extends EntityBase {
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง orgRoot",
})
orgRootId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
})
profileId: string;
@ManyToOne(() => OrgRoot, (orgRoot) => orgRoot.permissionOrgRoots)
@JoinColumn({ name: "orgRootId" })
orgRootTree: OrgRoot;
@ManyToOne(() => Profile, (profile) => profile.permissionProfiles)
@JoinColumn({ name: "profileId" })
profileTree: Profile;
}