25 lines
466 B
TypeScript
25 lines
466 B
TypeScript
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;
|
|
}
|
|
}
|