first commit
This commit is contained in:
17
src/domain/ProductEntity.js
Normal file
17
src/domain/ProductEntity.js
Normal file
@@ -0,0 +1,17 @@
|
||||
class ProductEntity {
|
||||
constructor({ nomeProduto, precoOriginal, precoPromocao, porcetagemPromo, imagem, linkProduto }) {
|
||||
this.nomeProduto = nomeProduto || 'sem título';
|
||||
this.precoOriginal = precoOriginal || 0;
|
||||
this.precoPromocao = precoPromocao || 0;
|
||||
this.porcetagemPromo = porcetagemPromo || 0;
|
||||
this.imagem = imagem || '';
|
||||
this.linkProduto = linkProduto || '';
|
||||
this.plataforma = 'Mercado Livre'; // Regra de negócio fixa para este robô
|
||||
}
|
||||
|
||||
isValid() {
|
||||
return this.nomeProduto !== 'Sem título' && this.precoPromocao > 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ProductEntity;
|
||||
Reference in New Issue
Block a user