typing and db types

This commit is contained in:
Julian Krauser 2024-09-16 07:24:41 +02:00
parent e455b5c8f6
commit 5fdfdcbd1f
9 changed files with 70 additions and 43 deletions

View file

@ -8,7 +8,7 @@ export class communication {
id: number;
@Column({ type: "boolean", default: false })
preffered: boolean;
preferred: boolean;
@Column({ type: "varchar", length: 255 })
mobile: string;

View file

@ -11,7 +11,19 @@ export class member {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "enum", enum: Salutation, default: Salutation.none })
@Column({
type: "varchar",
length: "255",
default: Salutation.none.toString(),
transformer: {
to(value: Salutation) {
return value.toString();
},
from(value: string) {
return Salutation[value as keyof typeof Salutation];
},
},
})
salutation: Salutation;
@Column({ type: "varchar", length: 255 })