Skip to content

Commit

Permalink
Update recommendations ASC 방식으로 개선 (#15)
Browse files Browse the repository at this point in the history
* Update restaurant_recommendation_repository.go: add asc order query

* Update restaurant_recommendation_repository.go: modifiy order id

* Update insert_mock_data.sql: add use line

* Update restaurant_recommendation_repository.go: rename recommendation_request_id to recommendation_id
  • Loading branch information
falconlee236 authored Nov 1, 2024
1 parent 9995e6c commit c0988be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ddl/insert_mock_data.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
USE `dittodining`;

INSERT INTO restaurant(restaurant_id,name,address,description,maximum_price_per_person,minimum_price_per_person,latitude,longitude,business_hours_json,recommendation_score,average_score_from_naver,total_review_count_from_naver,average_score_from_kakao,total_review_count_from_kakao,total_review_count) VALUES (1,'농민백암순대 본점','서울특별시 강남구 선릉로86길 40-4','다코숨은맛집'', ''수요미식회'', ''혼밥'', ''식사모임''',13000,10000,127.0530139,37.5037,'[
{
"dayOfWeek": "DAY_OF_WEEK_SUNDAY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (r *restaurantRecommendationRepository) FindAllByRestaurantRecommendationRe

whereConditions := make([]interface{}, 0)
if cursorRestaurantRecommendationID != nil {
whereConditions = append(whereConditions, "restaurant_recommendation_request_id < ?", *cursorRestaurantRecommendationID)
whereConditions = append(whereConditions, "restaurant_recommendation_id > ?", *cursorRestaurantRecommendationID)
}

limitQuery := 10
Expand All @@ -46,7 +46,7 @@ func (r *restaurantRecommendationRepository) FindAllByRestaurantRecommendationRe
RestaurantRecommendationRequestID: restaurantRecommendationRequestID,
},
whereConditions...).
Order("restaurant_recommendation_request_id DESC").
Order("restaurant_recommendation_id ASC").
Limit(limitQuery).
Find(&recommendations)
if result.Error != nil {
Expand Down

0 comments on commit c0988be

Please sign in to comment.