31 lines
759 B
TypeScript
31 lines
759 B
TypeScript
|
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||
|
import { NewsletterConfigType } from "../enums/newsletterConfigType";
|
||
|
import { communicationType } from "./communicationType";
|
||
|
|
||
|
@Entity()
|
||
|
export class newsletterConfig {
|
||
|
@PrimaryColumn({ type: "int" })
|
||
|
comTypeId: number;
|
||
|
|
||
|
@Column({
|
||
|
type: "varchar",
|
||
|
length: "255",
|
||
|
transformer: {
|
||
|
to(value: NewsletterConfigType) {
|
||
|
return value.toString();
|
||
|
},
|
||
|
from(value: string) {
|
||
|
return NewsletterConfigType[value as keyof typeof NewsletterConfigType];
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
config: NewsletterConfigType;
|
||
|
|
||
|
@ManyToOne(() => communicationType, {
|
||
|
nullable: false,
|
||
|
onDelete: "CASCADE",
|
||
|
onUpdate: "RESTRICT",
|
||
|
})
|
||
|
comType: communicationType;
|
||
|
}
|