newsletter config CRUD

This commit is contained in:
Julian Krauser 2024-12-26 11:08:48 +01:00
parent 01ce3fdd39
commit 7d36ed3121
14 changed files with 274 additions and 1 deletions

View file

@ -0,0 +1,30 @@
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;
}