22 lines
597 B
TypeScript
22 lines
597 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Product } from '../models/Product';
|
|
import { BaseDAO } from './BaseDAO';
|
|
import { DBProduct } from '../models/db/DBProduct';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class ProductDAO extends BaseDAO<Product, DBProduct, DBProduct> {
|
|
constructor() {
|
|
super(Product.name);
|
|
}
|
|
|
|
protected override toDB(model: Product): DBProduct {
|
|
return new Product(model.barcode, model.name, model.image, model.id);
|
|
}
|
|
|
|
protected override fromDB(qR: DBProduct): Product {
|
|
return new DBProduct(qR.barcode, qR.name, qR.image, qR.id);
|
|
}
|
|
}
|