From 4b26e5cb625a19e8798757b4f4cdc9bc129b8dac Mon Sep 17 00:00:00 2001 From: Niggl Date: Wed, 4 Nov 2020 20:42:43 +0100 Subject: [PATCH] Added simple customer and address models To be expanded --- models/address.ts | 26 ++++++++++++++++++++++++++ models/customer.ts | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 models/address.ts create mode 100644 models/customer.ts diff --git a/models/address.ts b/models/address.ts new file mode 100644 index 0000000..fdb3d36 --- /dev/null +++ b/models/address.ts @@ -0,0 +1,26 @@ +import {Entity, PrimaryGeneratedColumn, Column} from "typeorm"; + +@Entity() +export class Address { + + @PrimaryGeneratedColumn() + id: number; + + @Column() + street: string; + + @Column() + housenumber: string; + + @Column() + city: string; + + @Column() + plz: string; + + @Column() + state: string; + + @Column() + country: string; +} \ No newline at end of file diff --git a/models/customer.ts b/models/customer.ts new file mode 100644 index 0000000..67edf28 --- /dev/null +++ b/models/customer.ts @@ -0,0 +1,20 @@ +import {Entity, PrimaryGeneratedColumn, Column, JoinColumn} from "typeorm"; +import {Address} from "./Address"; + +@Entity() +export class Customer { + + @PrimaryGeneratedColumn() + id: number; + + @Column() + name: string; + + @Column() + lastName: string; + + @OneToOne(() => Address) + @JoinColumn + @Column() + invoiceAddress: Address; +} \ No newline at end of file