ff-admin-server/src/entity/communicationType.ts

32 lines
733 B
TypeScript
Raw Normal View History

2024-09-04 11:36:52 +02:00
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[];
}