migrate responsibility

This commit is contained in:
Kittapath 2024-05-14 15:29:05 +07:00
parent 6311c9cb0d
commit 2eee5404a1
11 changed files with 285 additions and 37 deletions

View file

@ -0,0 +1,52 @@
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({
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;
};