Merge branch 'net-dav' into develop
This commit is contained in:
commit
fefac93e56
6 changed files with 194 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { Entity, Column} from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
import { ProfileInformation } from "./ProfileInformation";
|
||||
|
||||
@Entity("bloodGroup")
|
||||
export class BloodGroup extends EntityBase {
|
||||
@Column({
|
||||
|
|
@ -10,6 +12,9 @@ export class BloodGroup extends EntityBase {
|
|||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => ProfileInformation, (profileInformation) => profileInformation.bloodGroupId)
|
||||
profileInformations: ProfileInformation[];
|
||||
}
|
||||
|
||||
export class CreateBloodGroup {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Entity, Column} from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
import { ProfileInformation } from "./ProfileInformation";
|
||||
|
||||
@Entity("gender")
|
||||
export class Gender extends EntityBase {
|
||||
@Column({
|
||||
|
|
@ -10,6 +12,9 @@ export class Gender extends EntityBase {
|
|||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => ProfileInformation, (profileInformation) => profileInformation.genderId)
|
||||
profileInformations: ProfileInformation[];
|
||||
}
|
||||
|
||||
export class CreateGender {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { ProfileAbility } from "./ProfileAbility";
|
|||
import { ProfileDuty } from "./ProfileDuty";
|
||||
import { ProfileNopaid } from "./ProfileNopaid";
|
||||
import { ProfileOther } from "./ProfileOther";
|
||||
import { ProfileInformation } from "./ProfileInformation";
|
||||
import { ProfileFamilyHistory } from "./ProfileFamily";
|
||||
|
||||
@Entity("profile")
|
||||
|
|
@ -192,6 +193,9 @@ export class Profile extends EntityBase {
|
|||
@ManyToOne(() => PosType, (posType) => posType.profiles)
|
||||
@JoinColumn({ name: "posTypeId" })
|
||||
posType: PosType;
|
||||
|
||||
@OneToMany(() => ProfileInformation, (profileInformation) => profileInformation.profile)
|
||||
profileInformation: ProfileInformation[];
|
||||
}
|
||||
|
||||
export class CreateProfile {
|
||||
|
|
|
|||
154
src/entities/ProfileInformation.ts
Normal file
154
src/entities/ProfileInformation.ts
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileInformationHistory } from "./ProfileInformationHistory";
|
||||
import { BloodGroup } from "./BloodGroup";
|
||||
import { Relationship } from "./Relationship";
|
||||
import { Gender } from "./Gender";
|
||||
@Entity("profileinformation")
|
||||
export class ProfileInformation extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เลขประจำตัวประชาชน",
|
||||
default: null,
|
||||
length: 13,
|
||||
})
|
||||
citizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำนำหน้าชื่อ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
prefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อ",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
firstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "นามสกุล",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
lastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วันเกิด",
|
||||
default: null,
|
||||
})
|
||||
birthDate: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เชื้อชาติ",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
ethnicity: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ศาสนา",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
religion: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เบอร์โทร",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
telephoneNumber: string;
|
||||
|
||||
@OneToMany(() => ProfileInformationHistory, (v) => v.profileInformation)
|
||||
profileInformationHistory: ProfileInformationHistory[];
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เพศ",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
genderId: string;
|
||||
|
||||
@ManyToOne(() => Gender, (v) => v.profileInformations)
|
||||
@JoinColumn({ name: "genderId" })
|
||||
gender: Gender;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ความสัมพันธ์",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
relationshipId: string;
|
||||
|
||||
@ManyToOne(() => Relationship, (v) => v.profileInformations)
|
||||
@JoinColumn({ name: "relationshipId" })
|
||||
relationship: Relationship;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "กรุ๊ปเลือด",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
bloodGroupId: string;
|
||||
|
||||
@ManyToOne(() => BloodGroup, (v) => v.profileInformations)
|
||||
@JoinColumn({ name: "bloodGroupId" })
|
||||
bloodGroup: BloodGroup;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.profileInformation)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
}
|
||||
|
||||
export class CreateProfileInformation {
|
||||
profileId: string | null;
|
||||
citizenId: string | null;
|
||||
prefix: string | null;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
birthDate: Date | null;
|
||||
ethnicity: string | null;
|
||||
religion: string | null;
|
||||
telephoneNumber: string | null;
|
||||
genderId: string | null;
|
||||
relationshipId: string | null;
|
||||
bloodGroupId: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileInformation = {
|
||||
citizenId?: string | null;
|
||||
prefix?: string | null;
|
||||
firstName?: string | null;
|
||||
lastName?: string | null;
|
||||
birthDate?: Date | null;
|
||||
ethnicity?: string | null;
|
||||
religion?: string | null;
|
||||
telephoneNumber?: string | null;
|
||||
genderId?: string | null;
|
||||
relationshipId?: string | null;
|
||||
bloodGroupId?: string | null;
|
||||
};
|
||||
18
src/entities/ProfileInformationHistory.ts
Normal file
18
src/entities/ProfileInformationHistory.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
|
||||
import { ProfileInformation } from "./ProfileInformation";
|
||||
|
||||
@Entity("profileinformationHistory")
|
||||
export class ProfileInformationHistory extends ProfileInformation {
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileInformation",
|
||||
default: null,
|
||||
})
|
||||
profileInformationId: string;
|
||||
|
||||
@ManyToOne(() => ProfileInformation, (v) => v.profileInformationHistory, { onDelete: "CASCADE" })
|
||||
@JoinColumn({ name: "profileInformationId" })
|
||||
profileInformation: ProfileInformation;
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import { Entity, Column} from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
import { ProfileInformation } from "./ProfileInformation";
|
||||
|
||||
@Entity("relationship")
|
||||
export class Relationship extends EntityBase {
|
||||
@Column({
|
||||
|
|
@ -10,6 +12,9 @@ export class Relationship extends EntityBase {
|
|||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => ProfileInformation, (profileInformation) => profileInformation.relationshipId)
|
||||
profileInformations: ProfileInformation[];
|
||||
}
|
||||
|
||||
export class CreateRelationship {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue