feat: add domain models

This commit is contained in:
2026-01-17 14:58:39 -03:00
parent ab2aca1d97
commit 90233c7208
5 changed files with 54 additions and 0 deletions

3
src/app/models/Chain.ts Normal file
View File

@@ -0,0 +1,3 @@
export class Chain {
constructor(public name: string | null, public image: string | null, public id?: number) {}
}

View File

@@ -0,0 +1,5 @@
import { Chain } from './Chain';
export class Establishment {
constructor(public chain: Chain, public address = '', public id?: number) {}
}

View File

@@ -0,0 +1,8 @@
export class Product {
constructor(
public barcode: string,
public name = '',
public image: string | null = null,
public id?: number
) {}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}