feat: colum stock in product
This commit is contained in:
parent
b7799b7ada
commit
56f7baf21d
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user