32 lines
733 B
TypeScript
32 lines
733 B
TypeScript
|
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[];
|
||
|
}
|