From 59a945aef939c62d357feb0a5b8fc83eebc80047 Mon Sep 17 00:00:00 2001 From: hocaron Date: Thu, 2 Nov 2023 01:11:56 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EB=A9=A4=EB=B2=84=20id=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/AttendanceFacadeService.java | 29 +++++++++++++------ .../response/PlatformAttendanceResponse.java | 6 ++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/mashup-member/src/main/java/kr/mashup/branding/facade/attendance/AttendanceFacadeService.java b/mashup-member/src/main/java/kr/mashup/branding/facade/attendance/AttendanceFacadeService.java index 8a03bfaf6..3e78dac71 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/facade/attendance/AttendanceFacadeService.java +++ b/mashup-member/src/main/java/kr/mashup/branding/facade/attendance/AttendanceFacadeService.java @@ -1,5 +1,19 @@ package kr.mashup.branding.facade.attendance; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + import kr.mashup.branding.domain.ResultCode; import kr.mashup.branding.domain.attendance.Attendance; import kr.mashup.branding.domain.attendance.AttendanceCode; @@ -22,17 +36,13 @@ import kr.mashup.branding.service.attendance.AttendanceService; import kr.mashup.branding.service.member.MemberService; import kr.mashup.branding.service.schedule.ScheduleService; -import kr.mashup.branding.ui.attendance.response.*; +import kr.mashup.branding.ui.attendance.response.AttendanceCheckResponse; +import kr.mashup.branding.ui.attendance.response.AttendanceInfo; +import kr.mashup.branding.ui.attendance.response.PersonalAttendanceResponse; +import kr.mashup.branding.ui.attendance.response.PlatformAttendanceResponse; +import kr.mashup.branding.ui.attendance.response.TotalAttendanceResponse; import kr.mashup.branding.util.DateUtil; import lombok.RequiredArgsConstructor; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.util.*; -import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -311,6 +321,7 @@ public PlatformAttendanceResponse getPlatformAttendance( members.stream() .map(member -> PlatformAttendanceResponse.MemberInfo.of( member.getName(), + member.getId(), getAttendanceInfoByMember( member, schedule.getEventList(), diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/attendance/response/PlatformAttendanceResponse.java b/mashup-member/src/main/java/kr/mashup/branding/ui/attendance/response/PlatformAttendanceResponse.java index 84b0c7c40..0d8d66715 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/attendance/response/PlatformAttendanceResponse.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/attendance/response/PlatformAttendanceResponse.java @@ -1,12 +1,12 @@ package kr.mashup.branding.ui.attendance.response; +import java.util.List; + import io.swagger.annotations.ApiModelProperty; import kr.mashup.branding.domain.member.Platform; import lombok.Getter; import lombok.Value; -import java.util.List; - @Getter @Value(staticConstructor = "of") public class PlatformAttendanceResponse { @@ -20,6 +20,8 @@ public class PlatformAttendanceResponse { public static class MemberInfo { @ApiModelProperty(required = true) String name; + @ApiModelProperty(required = true) + Long memberId; @ApiModelProperty(required = true, notes = "출석 정보가 없을 땐 빈 리스트") List attendanceInfos; } From 106da30e98c52577c53c51d68170d956a79312ad Mon Sep 17 00:00:00 2001 From: hocaron Date: Thu, 2 Nov 2023 01:12:25 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EB=A9=A4=EB=B2=84=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EC=A1=B0=ED=9A=8C=20API=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MemberProfileFacadeService.java | 13 +++++++--- .../ui/member/MemberGenerationController.java | 15 ++++++++--- .../ui/member/MemberProfileController.java | 26 +++++++++++++++---- .../response/MemberProfileResponse.java | 16 +++++++++--- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/mashup-member/src/main/java/kr/mashup/branding/facade/member/MemberProfileFacadeService.java b/mashup-member/src/main/java/kr/mashup/branding/facade/member/MemberProfileFacadeService.java index bc02f9b96..e92b8f58f 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/facade/member/MemberProfileFacadeService.java +++ b/mashup-member/src/main/java/kr/mashup/branding/facade/member/MemberProfileFacadeService.java @@ -1,17 +1,21 @@ package kr.mashup.branding.facade.member; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import kr.mashup.branding.domain.member.Member; import kr.mashup.branding.service.member.MemberProfileService; +import kr.mashup.branding.service.member.MemberService; import kr.mashup.branding.ui.member.request.MemberProfileRequest; import kr.mashup.branding.ui.member.response.MemberProfileResponse; import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor public class MemberProfileFacadeService { private final MemberProfileService memberProfileService; + private final MemberService memberService; @Transactional public Boolean updateMyProfile(Long memberId, MemberProfileRequest request) { @@ -34,8 +38,11 @@ public Boolean updateMyProfile(Long memberId, MemberProfileRequest request) { @Transactional public MemberProfileResponse getMyProfile(Long memberId) { + Member member = memberService.findMemberById(memberId); + var profile = memberProfileService.findOrSave(memberId); + var generations = memberService.findMemberGenerationByMemberId(member); - return MemberProfileResponse.from(profile); + return MemberProfileResponse.from(profile, generations); } } diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberGenerationController.java b/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberGenerationController.java index b61ffac96..ec38036e2 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberGenerationController.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberGenerationController.java @@ -1,5 +1,14 @@ package kr.mashup.branding.ui.member; +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import io.swagger.annotations.ApiOperation; import kr.mashup.branding.facade.member.MemberFacadeService; import kr.mashup.branding.security.MemberAuth; @@ -7,18 +16,16 @@ import kr.mashup.branding.ui.member.request.MemberGenerationRequest; import kr.mashup.branding.ui.member.response.MemberGenerationsResponse; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; -import javax.validation.Valid; - @RestController @RequestMapping("api/v1/member-generations") @RequiredArgsConstructor public class MemberGenerationController { private final MemberFacadeService memberFacadeService; - @ApiOperation("멤버 기수 정보 조회") + + @ApiOperation("나의 기수 정보 조회") @GetMapping("/my") public ApiResponse findMy( @ApiIgnore MemberAuth memberAuth diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberProfileController.java b/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberProfileController.java index 3d30cf39f..22c280718 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberProfileController.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/member/MemberProfileController.java @@ -1,5 +1,14 @@ package kr.mashup.branding.ui.member; +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import io.swagger.annotations.ApiOperation; import kr.mashup.branding.facade.member.MemberProfileFacadeService; import kr.mashup.branding.security.MemberAuth; @@ -7,18 +16,16 @@ import kr.mashup.branding.ui.member.request.MemberProfileRequest; import kr.mashup.branding.ui.member.response.MemberProfileResponse; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; -import javax.validation.Valid; - @RestController @RequestMapping("api/v1/member-profiles") @RequiredArgsConstructor public class MemberProfileController { private final MemberProfileFacadeService memberProfileFacadeService; - @ApiOperation("멤버 프로필 조회") + + @ApiOperation("나의 프로필 조회") @GetMapping("/my") public ApiResponse getMyProfile( @ApiIgnore MemberAuth memberAuth @@ -29,7 +36,7 @@ public ApiResponse getMyProfile( return ApiResponse.success(response); } - @ApiOperation("멤버 프로필 업데이트") + @ApiOperation("나의 프로필 업데이트") @PatchMapping("/my") public ApiResponse updateMyProfile( @ApiIgnore MemberAuth memberAuth, @@ -40,4 +47,13 @@ public ApiResponse updateMyProfile( return ApiResponse.success(response); } + + @ApiOperation("멤버 프로필 조회") + @GetMapping("/{memberId}") + public ApiResponse getMemberProfile(@PathVariable Long memberId) { + final MemberProfileResponse response + = memberProfileFacadeService.getMyProfile(memberId); + + return ApiResponse.success(response); + } } diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/member/response/MemberProfileResponse.java b/mashup-member/src/main/java/kr/mashup/branding/ui/member/response/MemberProfileResponse.java index 57db03512..51818a879 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/member/response/MemberProfileResponse.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/member/response/MemberProfileResponse.java @@ -1,11 +1,14 @@ package kr.mashup.branding.ui.member.response; +import java.time.LocalDate; +import java.util.List; +import java.util.stream.Collectors; + +import kr.mashup.branding.domain.member.MemberGeneration; import kr.mashup.branding.domain.member.MemberProfile; import lombok.AllArgsConstructor; import lombok.Getter; -import java.time.LocalDate; - @Getter @AllArgsConstructor public class MemberProfileResponse { @@ -32,7 +35,9 @@ public class MemberProfileResponse { private String linkedInLink; // 링크드인 링크 - public static MemberProfileResponse from(MemberProfile memberProfile) { + private List memberGenerations; + + public static MemberProfileResponse from(MemberProfile memberProfile, List memberGenerations) { return new MemberProfileResponse( memberProfile.getMemberId(), memberProfile.getBirthDate(), @@ -44,7 +49,10 @@ public static MemberProfileResponse from(MemberProfile memberProfile) { memberProfile.getGithubLink(), memberProfile.getPortfolioLink(), memberProfile.getBlogLink(), - memberProfile.getLinkedInLink() + memberProfile.getLinkedInLink(), + memberGenerations.stream() + .map(MemberGenerationResponse::of) + .collect(Collectors.toList()) ); } } From 5345a97b0da5b6973b938bef93b99d4e82a3079b Mon Sep 17 00:00:00 2001 From: hocaron Date: Thu, 2 Nov 2023 01:12:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EB=A9=A4=EB=B2=84=20=EC=A0=90?= =?UTF-8?q?=EC=88=98=20=EC=A1=B0=ED=9A=8C=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScoreHistoryFacadeService.java | 17 ++++++------- .../scorehistory/ScoreHistoryController.java | 24 +++++++++++++++---- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/mashup-member/src/main/java/kr/mashup/branding/facade/scorehistory/ScoreHistoryFacadeService.java b/mashup-member/src/main/java/kr/mashup/branding/facade/scorehistory/ScoreHistoryFacadeService.java index ca2274f91..a0805e4d6 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/facade/scorehistory/ScoreHistoryFacadeService.java +++ b/mashup-member/src/main/java/kr/mashup/branding/facade/scorehistory/ScoreHistoryFacadeService.java @@ -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 diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/scorehistory/ScoreHistoryController.java b/mashup-member/src/main/java/kr/mashup/branding/ui/scorehistory/ScoreHistoryController.java index 6803467b2..d4e132d84 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/scorehistory/ScoreHistoryController.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/scorehistory/ScoreHistoryController.java @@ -1,5 +1,12 @@ 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; @@ -7,13 +14,8 @@ 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 @@ -30,4 +32,16 @@ public ApiResponse getScoreHistory(@ApiIgnore MemberAuth return ApiResponse.success(ScoreHistoriesResponse.of(scoreHistoryResponses)); } + + @ApiOperation("멤버 점수") + @GetMapping("/{memberId}") + public ApiResponse getScore(@PathVariable Long memberId) { + + final ScoreHistoryResponse scoreHistoryResponses + = scoreHistoryFacadeService.getScoreHistory(memberId) + .stream().findFirst() + .orElse(null); + + return ApiResponse.success(scoreHistoryResponses); + } }