ff-admin-server/src/entity/configuration/newsletterConfig.ts

32 lines
772 B
TypeScript
Raw Normal View History

2024-12-26 11:08:48 +01:00
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
2025-01-05 14:14:00 +01:00
import { NewsletterConfigType } from "../../enums/newsletterConfigType";
2024-12-26 11:08:48 +01:00
import { communicationType } from "./communicationType";
@Entity()
export class newsletterConfig {
2025-01-29 16:49:34 +01:00
@PrimaryColumn()
2024-12-26 11:08:48 +01:00
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",
2025-01-29 16:49:34 +01:00
cascade: ["insert"],
2024-12-26 11:08:48 +01:00
})
comType: communicationType;
}