diff --git a/internal/entity/product.go b/internal/entity/product.go index 4521508..e36e487 100644 --- a/internal/entity/product.go +++ b/internal/entity/product.go @@ -21,6 +21,7 @@ type Product struct { DeletedAt *time.Time `gorm:"column:deleted_at"` CreatedBy int64 `gorm:"type:int;column:created_by"` UpdatedBy int64 `gorm:"type:int;column:updated_by"` + Stock int64 `gorm:"type:int;column:stock"` } func (Product) TableName() string { @@ -75,6 +76,7 @@ func (e *ProductDB) ToProduct() *Product { SiteID: e.SiteID, IsSeasonTicket: e.IsSeasonTicket, IsWeekendTicket: e.IsWeekendTicket, + Stock: e.Stock, } } diff --git a/internal/handlers/response/product.go b/internal/handlers/response/product.go index e867522..3f62b8b 100644 --- a/internal/handlers/response/product.go +++ b/internal/handlers/response/product.go @@ -13,6 +13,7 @@ type Product struct { Description string `json:"description"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` + Stock int64 `json:"stock"` } type ProductList struct { diff --git a/internal/services/product/product.go b/internal/services/product/product.go index 105621c..829bef0 100644 --- a/internal/services/product/product.go +++ b/internal/services/product/product.go @@ -2,6 +2,7 @@ package product import ( "context" + "fmt" "furtuna-be/internal/common/logger" "furtuna-be/internal/common/mycontext" "furtuna-be/internal/entity" @@ -62,6 +63,7 @@ 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