self defined value tables

This commit is contained in:
Julian Krauser 2024-09-04 11:36:52 +02:00
parent 6286add31c
commit c85f23ed73
8 changed files with 382 additions and 3 deletions

16
src/entity/award.ts Normal file
View file

@ -0,0 +1,16 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
//import { memberAwards } from "./memberAwards";
@Entity()
export class award {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
award: string;
// @OneToMany(() => memberAwards, (member) => member.award, {
// onDelete: "RESTRICT",
// })
// members: memberAwards[];
}

View file

@ -0,0 +1,40 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
//import { member } from "./member";
import { communicationType } from "./communicationType";
@Entity()
export class communication {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "boolean", default: false })
preffered: boolean;
@Column({ type: "varchar", length: 255 })
mobile: string;
@Column({ type: "varchar", length: 255 })
email: string;
@Column({ type: "varchar", length: 255 })
city: string;
@Column({ type: "varchar", length: 255 })
street: string;
@Column({ type: "integer" })
streetNumber: number;
@Column({ type: "varchar", length: 255 })
streetNumberAddition: string;
@ManyToOne(() => communicationType, (communicationType) => communicationType.communications, {
nullable: false,
})
type: communicationType;
// @ManyToOne(() => member, (member) => member.awards, {
// onDelete: "RESTRICT",
// })
// member: member;
}

View file

@ -0,0 +1,31 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
import { communication } from "./communication";
@Entity()
export class communicationType {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
type: string;
@Column({
type: "varchar",
length: 255,
default: "",
transformer: {
from(value: string): Array<string> {
return value.split(",");
},
to(value: Array<string>): string {
return value.join(",");
},
},
})
useColumns: Array<string>;
@OneToMany(() => communication, (communication) => communication.type, {
onDelete: "RESTRICT",
})
communications: communication[];
}

View file

@ -0,0 +1,16 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
//import { memberExecutivePositions } from "./memberExecutivePositions";
@Entity()
export class executivePosition {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
position: string;
// @OneToMany(() => memberExecutivePositions, (memberExecutivePositions) => memberExecutivePositions.executivePosition, {
// onDelete: "RESTRICT",
// })
// members: memberExecutivePositions[];
}

View file

@ -0,0 +1,14 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
//import { membership } from "./membership";
@Entity()
export class membershipStatus {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
status: string;
// @OneToMany(() => membership, (membership) => membership.status)
// memberships: membership[];
}

View file

@ -0,0 +1,19 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
//import { memberQualifications } from "./memberQualifications";
@Entity()
export class qualification {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
qualification: string;
@Column({ type: "varchar", length: 255, nullable: true, default: null })
description?: string;
// @OneToMany(() => memberQualifications, (memberQualifications) => memberQualifications.qualification, {
// onDelete: "RESTRICT",
// })
// members: memberQualifications[];
}