feat: add domain models
This commit is contained in:
24
src/app/models/Purchase.ts
Normal file
24
src/app/models/Purchase.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user