-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#116] ์ ์ฒด ์ ์ ์ ํ๋ณต ์ง๋ API ๊ตฌ์ถ
- Loading branch information
Showing
5 changed files
with
120 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ain/java/com/hobak/happinessql/domain/report/application/TrendLocationRankingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.hobak.happinessql.domain.report.application; | ||
|
||
import com.hobak.happinessql.domain.record.domain.Record; | ||
import com.hobak.happinessql.domain.record.repository.RecordRepository; | ||
import com.hobak.happinessql.domain.report.dto.LocationActivityRankingResponseDto; | ||
import com.hobak.happinessql.domain.user.domain.User; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TrendLocationRankingService { | ||
|
||
private final RecordRepository recordRepository; | ||
|
||
public List<LocationActivityRankingResponseDto> getTop3HappyLocationsWithActivities(User user) { | ||
List<Record> records = recordRepository.findAllByUser(user); | ||
return LocationHappinessAnalyzer.getLocationActivityRankings(records, 3); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...main/java/com/hobak/happinessql/domain/report/dto/LocationActivityRankingResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.hobak.happinessql.domain.report.dto; | ||
|
||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class LocationActivityRankingResponseDto { | ||
private int ranking; | ||
private String location; | ||
private Double latitude; | ||
private Double longitude; | ||
private String happiestActivity; | ||
|
||
@Builder | ||
public LocationActivityRankingResponseDto(int ranking, String location, Double latitude, Double longitude, String happiestActivity) { | ||
this.ranking = ranking; | ||
this.location = location; | ||
this.latitude = latitude; | ||
this.longitude = longitude; | ||
this.happiestActivity = happiestActivity; | ||
} | ||
} |