65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
import { ProfileEmployee } from "./ProfileEmployee";
|
|
|
|
@Entity("profileAvatar")
|
|
export class ProfileAvatar extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รูปถ่าย",
|
|
default: null,
|
|
})
|
|
avatar: string;
|
|
|
|
@Column({
|
|
comment: "สถานะการใช้งาน",
|
|
default: false,
|
|
})
|
|
isActive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รูปถ่าย",
|
|
default: null,
|
|
})
|
|
avatarName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
|
default: null,
|
|
})
|
|
profileEmployeeId: string;
|
|
|
|
@ManyToOne(() => Profile, (profile) => profile.profileAvatars)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
|
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAvatars)
|
|
@JoinColumn({ name: "profileEmployeeId" })
|
|
profileEmployee: ProfileEmployee;
|
|
}
|
|
|
|
export class CreateProfileAvatar {
|
|
profileId: string;
|
|
// avatar: string | null;
|
|
}
|
|
|
|
export class CreateProfileEmployeeAvatar {
|
|
profileEmployeeId: string;
|
|
// avatar: string | null;
|
|
}
|
|
|
|
export type UpdateProfileAvatar = {
|
|
avatar?: string | null;
|
|
};
|