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

66 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-05-14 15:29:05 +07:00
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;
2024-05-15 15:29:23 +07:00
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
2024-05-15 15:29:23 +07:00
nullable: true,
comment: "รูปถ่าย",
default: null,
})
avatarName: string;
2024-05-14 15:29:05 +07:00
@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;
2024-05-14 16:20:36 +07:00
// avatar: string | null;
2024-05-14 15:29:05 +07:00
}
export class CreateProfileEmployeeAvatar {
profileEmployeeId: string;
2024-05-14 16:20:36 +07:00
// avatar: string | null;
2024-05-14 15:29:05 +07:00
}
export type UpdateProfileAvatar = {
avatar?: string | null;
};