Skip to content

Commit

Permalink
Merge pull request #17 from Ulas-Scan/development
Browse files Browse the repository at this point in the history
fix: response adjustment on history response
  • Loading branch information
iyoubee authored Jun 16, 2024
2 parents f078584 + e1b8858 commit 081887f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions controller/ml.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ func (c *mlController) GetSentimentAnalysisAndSummarization(ctx *gin.Context) {
Bintang: ratingAvg,
URL: productReq.ProductUrl,
ProductName: product.ProductName,
PositiveCount: predictResult.CountPositive,
NegativeCount: predictResult.CountNegative,
CountPositive: predictResult.CountPositive,
CountNegative: predictResult.CountNegative,
Packaging: analyzeResult.Packaging,
Delivery: analyzeResult.Delivery,
AdminResponse: analyzeResult.AdminResponse,
ProductCondition: analyzeResult.ProductCondition,
Content: summarizeResult,
Summary: summarizeResult,
}
_, err = c.historyService.CreateHistory(ctx, history)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions dto/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ type (
Ulasan int `json:"ulasan" form:"ulasan" binding:"required"`
Bintang float64 `json:"bintang" form:"bintang" binding:"required"`
ProductName string `json:"product_name" form:"product_name" binding:"required"`
PositiveCount int `json:"positive_count" form:"positive_count" binding:"required"`
NegativeCount int `json:"negative_count" form:"negative_count" binding:"required"`
CountPositive int `json:"count_positive" form:"count_positive" binding:"required"`
CountNegative int `json:"count_negative" form:"count_negative" binding:"required"`
Packaging float32 `json:"packaging" form:"packaging" binding:"required"`
Delivery float32 `json:"delivery" form:"delivery" binding:"required"`
AdminResponse float32 `json:"admin_response" form:"admin_response" binding:"required"`
ProductCondition float32 `json:"product_condition" form:"product_condition" binding:"required"`
Content string `json:"content" form:"content"`
Summary string `json:"summary" form:"content"`
}

HistoryResponse struct {
Expand All @@ -67,12 +67,12 @@ type (
Ulasan int `json:"ulasan"`
Bintang float64 `json:"bintang"`
ProductName string `json:"product_name"`
PositiveCount int `json:"positive_count" `
NegativeCount int `json:"negative_count" `
CountPositive int `json:"count_positive" `
CountNegative int `json:"count_negative" `
Packaging float32 `json:"packaging"`
Delivery float32 `json:"delivery"`
AdminResponse float32 `json:"admin_response"`
ProductCondition float32 `json:"product_condition"`
Content string `json:"content"`
Summary string `json:"summary"`
}
)
6 changes: 3 additions & 3 deletions entity/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ type History struct {
URL string `json:"url" gorm:"not null"`
ProductID string `json:"product_id" gorm:"not null" `
ProductName string `json:"product_name" gorm:"not null"`
PositiveCount int `json:"positive_count" gorm:"not null"`
NegativeCount int `json:"negative_count" gorm:"not null"`
CountPositive int `json:"count_positive" gorm:"not null"`
CountNegative int `json:"count_negative" gorm:"not null"`
Rating int `json:"rating" gorm:"not null"`
Ulasan int `json:"ulasan" gorm:"not null"`
Bintang float64 `json:"bintang" gorm:"not null"`
Packaging float32 `json:"packaging" gorm:"not null"`
Delivery float32 `json:"delivery" gorm:"not null"`
AdminResponse float32 `json:"admin_response" gorm:"not null"`
ProductCondition float32 `json:"product_condition" gorm:"not null"`
Content string `json:"content" gorm:"not null"`
Summary string `json:"summary" gorm:"not null"`
UserID uuid.UUID `json:"user_id" gorm:"not null" `
User User `json:"-" gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE;"`

Expand Down
18 changes: 9 additions & 9 deletions service/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func (s *historyService) CreateHistory(ctx context.Context, req dto.HistoryCreat
Rating: req.Rating,
Ulasan: req.Ulasan,
Bintang: req.Bintang,
PositiveCount: req.PositiveCount,
NegativeCount: req.NegativeCount,
CountPositive: req.CountPositive,
CountNegative: req.CountNegative,
Packaging: req.Packaging,
Delivery: req.Delivery,
AdminResponse: req.AdminResponse,
ProductCondition: req.ProductCondition,
Content: req.Content,
Summary: req.Summary,
UserID: req.UserID,
}

Expand All @@ -66,13 +66,13 @@ func (s *historyService) CreateHistory(ctx context.Context, req dto.HistoryCreat
Ulasan: historyCreated.Ulasan,
Bintang: historyCreated.Bintang,
ProductName: historyCreated.ProductName,
PositiveCount: historyCreated.PositiveCount,
NegativeCount: historyCreated.NegativeCount,
CountPositive: historyCreated.CountPositive,
CountNegative: historyCreated.CountNegative,
Packaging: historyCreated.Packaging,
Delivery: historyCreated.Delivery,
AdminResponse: historyCreated.AdminResponse,
ProductCondition: historyCreated.ProductCondition,
Content: historyCreated.Content,
Summary: historyCreated.Summary,
}, nil
}

Expand Down Expand Up @@ -108,12 +108,12 @@ func (s *historyService) GetHistoryById(ctx context.Context, historyId string, u
Ulasan: history.Ulasan,
Bintang: history.Bintang,
ProductName: history.ProductName,
PositiveCount: history.PositiveCount,
NegativeCount: history.NegativeCount,
CountPositive: history.CountPositive,
CountNegative: history.CountNegative,
Packaging: history.Packaging,
Delivery: history.Delivery,
AdminResponse: history.AdminResponse,
ProductCondition: history.ProductCondition,
Content: history.Content,
Summary: history.Summary,
}, nil
}

0 comments on commit 081887f

Please sign in to comment.