migrate responsibility
This commit is contained in:
parent
6311c9cb0d
commit
2eee5404a1
11 changed files with 285 additions and 37 deletions
52
src/entities/ProfileAvatar.ts
Normal file
52
src/entities/ProfileAvatar.ts
Normal 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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue