feat: site stock
This commit is contained in:
parent
56f7baf21d
commit
57f019b1e9
@ -284,6 +284,7 @@ func (h *Handler) toProductResponse(resp *entity.Product) response.Product {
|
||||
SiteID: resp.SiteID,
|
||||
IsSeasonTicket: resp.IsSeasonTicket,
|
||||
IsWeekendTicket: resp.IsWeekendTicket,
|
||||
Stock: resp.Stock,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -324,6 +324,7 @@ func (h *Handler) toProductResponseList(products []entity.Product) []response.Pr
|
||||
Description: product.Description,
|
||||
CreatedAt: product.CreatedAt.Format(time.RFC3339),
|
||||
UpdatedAt: product.UpdatedAt.Format(time.RFC3339),
|
||||
Stock: product.Stock,
|
||||
})
|
||||
}
|
||||
return res
|
||||
|
||||
@ -37,6 +37,7 @@ type Product struct {
|
||||
IsSeasonTicket bool `json:"is_season_ticket"`
|
||||
Status string `json:"status"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Stock int64 `json:"stock"`
|
||||
}
|
||||
|
||||
func (e *Product) ToEntity() *entity.Product {
|
||||
@ -46,5 +47,6 @@ func (e *Product) ToEntity() *entity.Product {
|
||||
Price: e.Price,
|
||||
Status: e.Status,
|
||||
Description: e.Description,
|
||||
Stock: e.Stock,
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ func (r *Site) ToEntity(createdBy int64) *entity.Site {
|
||||
Status: p.Status,
|
||||
Description: p.Description,
|
||||
CreatedBy: createdBy,
|
||||
Stock: p.Stock,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"furtuna-be/internal/common/logger"
|
||||
"furtuna-be/internal/common/mycontext"
|
||||
"furtuna-be/internal/entity"
|
||||
@ -63,7 +62,6 @@ func (s *ProductService) GetByID(ctx context.Context, id int64) (*entity.Product
|
||||
|
||||
func (s *ProductService) GetAll(ctx context.Context, search entity.ProductSearch) ([]*entity.Product, int, error) {
|
||||
products, total, err := s.repo.GetAllProducts(ctx, search)
|
||||
fmt.Println(products, "tes")
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when get all products", zap.Error(err))
|
||||
return nil, 0, err
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user