diff --git a/src/app/models/Chain.ts b/src/app/models/Chain.ts new file mode 100644 index 0000000..b1db4cd --- /dev/null +++ b/src/app/models/Chain.ts @@ -0,0 +1,3 @@ +export class Chain { + constructor(public name: string | null, public image: string | null, public id?: number) {} +} diff --git a/src/app/models/Establishment.ts b/src/app/models/Establishment.ts new file mode 100644 index 0000000..320ef32 --- /dev/null +++ b/src/app/models/Establishment.ts @@ -0,0 +1,5 @@ +import { Chain } from './Chain'; + +export class Establishment { + constructor(public chain: Chain, public address = '', public id?: number) {} +} diff --git a/src/app/models/Product.ts b/src/app/models/Product.ts new file mode 100644 index 0000000..82319ab --- /dev/null +++ b/src/app/models/Product.ts @@ -0,0 +1,8 @@ +export class Product { + constructor( + public barcode: string, + public name = '', + public image: string | null = null, + public id?: number + ) {} +} diff --git a/src/app/models/ProductEstablisment.ts b/src/app/models/ProductEstablisment.ts new file mode 100644 index 0000000..1ab452e --- /dev/null +++ b/src/app/models/ProductEstablisment.ts @@ -0,0 +1,14 @@ +import { Establishment } from './Establishment'; +import { Product } from './Product'; + +export class ProductEstablishment { + id?: number; + establishment: Establishment; + product: Product; + + constructor(product: Product, establishment: Establishment, id?: number) { + this.id = id; + this.establishment = establishment; + this.product = product; + } +} diff --git a/src/app/models/Purchase.ts b/src/app/models/Purchase.ts new file mode 100644 index 0000000..a3514ac --- /dev/null +++ b/src/app/models/Purchase.ts @@ -0,0 +1,24 @@ +import { Establishment } from './Establishment'; +import { Product } from './Product'; + +export class Purchase { + #price: number; + constructor( + public establishment: Establishment, + public product: Product, + price = 0, + public quantity = 1, + public date = Date.now(), + public id?: number + ) { + this.#price = price * 100; + } + + get price() { + return this.#price / 100; + } + + set price(price: number) { + this.#price = price * 100; + } +}