Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
development to staging(#114)
Browse files Browse the repository at this point in the history
Development to staging
  • Loading branch information
AriefLazuardi authored Dec 15, 2023
2 parents 12152de + c3698e2 commit c384e82
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion handler/productHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ func (c *ProductHandlerImpl) ProductAIHandler(ctx echo.Context) error {
return ctx.JSON(http.StatusInternalServerError, helpers.ErrorResponse("Error getting product recommendation"))
}

response := res.ConvertProductRecommendationResponse(result)

return ctx.JSON(http.StatusOK, helpers.SuccessResponse("success get product recommendation", result))
return ctx.JSON(http.StatusOK, helpers.SuccessResponse("success get product recommendation", response))
}


Expand Down
4 changes: 4 additions & 0 deletions models/domain/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ type BestSellingProduct struct {
ProductTypeName string
TotalQuantity int
Amount float64
}

type ProductRecommendation struct {
Reply string
}
4 changes: 4 additions & 0 deletions models/web/productResponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ type BestProductsResponse struct {
TotalQuantity int `json:"totalQuantity"`
Amount float64 `json:"amount"`
}

type ProductRecommendation struct {
Reply string `json:"reply"`
}
6 changes: 6 additions & 0 deletions utils/response/productConvertResponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ func ConvertBestProductResponse(bestProducts []domain.BestSellingProduct) []web.
return results
}

func ConvertProductRecommendationResponse(recommendation string) web.ProductRecommendation {
return web.ProductRecommendation{
Reply: recommendation,
}
}

func ConvertProductResponse(products []domain.Product) []web.ProductsResponse {
var results []web.ProductsResponse

Expand Down

0 comments on commit c384e82

Please sign in to comment.