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";
import { NewsletterConfigEnum } from "../../enums/newsletterConfigEnum";
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: NewsletterConfigEnum) {
2024-12-26 11:08:48 +01:00
return value.toString();
},
from(value: string) {
return NewsletterConfigEnum[value as keyof typeof NewsletterConfigEnum];
2024-12-26 11:08:48 +01:00
},
},
})
config: NewsletterConfigEnum;
2024-12-26 11:08:48 +01:00
@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;
}