newsletter config CRUD
This commit is contained in:
parent
01ce3fdd39
commit
7d36ed3121
14 changed files with 274 additions and 1 deletions
30
src/entity/newsletterConfig.ts
Normal file
30
src/entity/newsletterConfig.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue