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

31 lines
762 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 {
@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;
}