Skip to content

Commit

Permalink
feat: 멤버 점수 조회 API 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hocaron committed Nov 1, 2023
1 parent 106da30 commit 5345a97
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package kr.mashup.branding.facade.scorehistory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import kr.mashup.branding.domain.member.Member;
import kr.mashup.branding.domain.scorehistory.ScoreHistory;
import kr.mashup.branding.service.member.MemberService;
import kr.mashup.branding.service.scorehistory.ScoreHistoryService;
import kr.mashup.branding.ui.scorehistory.response.ScoreHistoryResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package kr.mashup.branding.ui.scorehistory;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import kr.mashup.branding.facade.scorehistory.ScoreHistoryFacadeService;
import kr.mashup.branding.security.MemberAuth;
import kr.mashup.branding.ui.ApiResponse;
import kr.mashup.branding.ui.scorehistory.response.ScoreHistoriesResponse;
import kr.mashup.branding.ui.scorehistory.response.ScoreHistoryResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RestController
@RequestMapping("/api/v1/score-history")
@RequiredArgsConstructor
Expand All @@ -30,4 +32,16 @@ public ApiResponse<ScoreHistoriesResponse> getScoreHistory(@ApiIgnore MemberAuth

return ApiResponse.success(ScoreHistoriesResponse.of(scoreHistoryResponses));
}

@ApiOperation("멤버 점수")
@GetMapping("/{memberId}")
public ApiResponse<ScoreHistoryResponse> getScore(@PathVariable Long memberId) {

final ScoreHistoryResponse scoreHistoryResponses
= scoreHistoryFacadeService.getScoreHistory(memberId)
.stream().findFirst()
.orElse(null);

return ApiResponse.success(scoreHistoryResponses);
}
}

0 comments on commit 5345a97

Please sign in to comment.