52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
const { Entity } = require('./entity');
|
|
const {Product} = require('./product');
|
|
|
|
class Website {
|
|
|
|
/**
|
|
* @param {Object} details
|
|
*/
|
|
constructor(companyName){
|
|
this.firstName = '';
|
|
this.lastName = '';
|
|
this.companyName = companyName;
|
|
this.logoUrl = '';
|
|
this.bannerUrl = '';
|
|
this.desc = '';
|
|
this.email = '';
|
|
//uses key value pair to store product
|
|
//key is the productId of the product
|
|
//value is the product itself
|
|
this.products = new Entity();
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {Product} product
|
|
*/
|
|
addProduct(product){
|
|
return this.products.addData(product.id, product);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {string} productId
|
|
* @returns {Product}
|
|
*/
|
|
getProduct(productId){
|
|
return this.products.getData(productId);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {string} productId
|
|
*/
|
|
deleteProduct(productId){
|
|
|
|
return this.products.deleteData(productId);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
module.exports.Website = Website; |