refactor(trade): remove OriginalPrice and Location fields from trade items
This commit is contained in:
@@ -37,17 +37,15 @@ func NewTradeService(tradeRepo repository.TradeRepository) TradeService {
|
||||
|
||||
func (s *tradeService) Create(ctx context.Context, userID string, req dto.CreateTradeItemRequest) (*model.TradeItem, error) {
|
||||
item := &model.TradeItem{
|
||||
UserID: userID,
|
||||
TradeType: model.TradeType(req.TradeType),
|
||||
Category: model.TradeCategory(req.Category),
|
||||
Title: req.Title,
|
||||
Content: req.Content,
|
||||
Segments: req.Segments,
|
||||
Price: req.Price,
|
||||
OriginalPrice: req.OriginalPrice,
|
||||
Condition: req.Condition,
|
||||
Location: req.Location,
|
||||
Status: model.TradeItemActive,
|
||||
UserID: userID,
|
||||
TradeType: model.TradeType(req.TradeType),
|
||||
Category: model.TradeCategory(req.Category),
|
||||
Title: req.Title,
|
||||
Content: req.Content,
|
||||
Segments: req.Segments,
|
||||
Price: req.Price,
|
||||
Condition: req.Condition,
|
||||
Status: model.TradeItemActive,
|
||||
}
|
||||
if item.Content == "" {
|
||||
item.Content = item.Title
|
||||
@@ -112,15 +110,9 @@ func (s *tradeService) Update(ctx context.Context, userID string, id string, req
|
||||
if req.Price != nil {
|
||||
item.Price = req.Price
|
||||
}
|
||||
if req.OriginalPrice != nil {
|
||||
item.OriginalPrice = req.OriginalPrice
|
||||
}
|
||||
if req.Condition != nil {
|
||||
item.Condition = *req.Condition
|
||||
}
|
||||
if req.Location != nil {
|
||||
item.Location = *req.Location
|
||||
}
|
||||
item.UpdatedAt = time.Now()
|
||||
|
||||
if req.Images != nil {
|
||||
|
||||
Reference in New Issue
Block a user