refactor(trade): remove OriginalPrice and Location fields from trade items
Some checks failed
Build Backend / build-docker (pull_request) Has been cancelled
Build Backend / build (pull_request) Has been cancelled
Deploy / deploy (pull_request) Has been cancelled

This commit is contained in:
lafay
2026-04-26 17:14:05 +08:00
parent 0ca02f7ef3
commit 3e32b28578
4 changed files with 9 additions and 31 deletions

View File

@@ -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 {