feat: criando a view do menu e as regras de cadastro e listagem de produtos

This commit is contained in:
2026-07-14 20:16:10 -03:00
parent ada03a9ddb
commit 70f433ce2b
5 changed files with 97 additions and 2 deletions
View File
+49
View File
@@ -0,0 +1,49 @@
package model
type Product struct {
ID int
Name string
Category string
Price float64
Quantity int
}
type ProductInput struct {
Name string
Category string
Price float64
Quantity int
}
type Inventory struct {
products []Product
nextID int
}
func NewInventory() *Inventory {
return &Inventory{}
}
func (e *Inventory) AdicionarProduto(i *ProductInput) Product {
e.nextID += 1
product := Product{
ID: e.nextID,
Name: i.Name,
Category: i.Category,
Price: i.Price,
Quantity: i.Quantity,
}
e.products = append(e.products, product)
return product
}
func (e *Inventory) ListarProduto() []Product {
return e.products
}
func (e *Inventory) AtualizarProduto() {}
func (e *Inventory) DeletarProduto() {}