Skip to content

Commit

Permalink
Refactor : @Login 제거 및 memberId = 1L 임시 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
Suhun0331 committed Dec 8, 2024
1 parent a771a28 commit b2af6c3
Show file tree
Hide file tree
Showing 21 changed files with 1,572 additions and 1,577 deletions.
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ dependencies {
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

//s3
implementation 'software.amazon.awssdk:s3:2.17.285'

// OAuth2
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

// Spring-security
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.security:spring-security-test'

// Jwt
implementation group:'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group:'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
implementation group:'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public class DashBoardController {
description = "메인화면에 사용자이름, 가입한 기간, 활동, 지원현황 갯수 데이터를 응답합니다.")
@GetMapping("/user-info")
public ResponseEntity<DashBoardUserInfoResponse> getUserInfo(
@Login LoginInfo loginInfo
) {
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
DashBoardUserInfoResponse response = dashBoardService.getUserInfo(requestMember);
return ResponseEntity
.ok()
Expand All @@ -53,9 +53,9 @@ public ResponseEntity<DashBoardUserInfoResponse> getUserInfo(
)
@GetMapping("/remind/recruit")
public ResponseEntity<RecruitRemindResponse> getRemindRecruits(
@Login LoginInfo loginInfo
) {
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
RecruitRemindResponse response = dashBoardService.getTopTwoRecruitsByEndTime(requestMember);
return ResponseEntity
.ok()
Expand All @@ -65,9 +65,9 @@ public ResponseEntity<RecruitRemindResponse> getRemindRecruits(
@GetMapping("/introduce")
@Operation(summary = "홈 자기소개서 작성 알림")
public ResponseEntity<Object> get(
@Login LoginInfo loginInfo
){
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
List<IntroduceRemindResponse> homeIntroduceResDtos = dashBoardService.getHomeIntro(requestMember);
return ResponseEntity
.status(HttpStatus.OK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import umc.kkijuk.server.common.LoginUser;
import umc.kkijuk.server.detail.controller.response.BaseCareerDetailResponse;
import umc.kkijuk.server.detail.controller.response.CareerDetailResponse;
import umc.kkijuk.server.detail.dto.CareerDetailReqDto;
Expand All @@ -32,11 +33,11 @@ public class BaseCareerDetailController {
@Parameter(name = "careerId", description = "활동 Id, path variable 입니다."),
})
public CareerDetailResponse<BaseCareerDetailResponse> create(
@Login LoginInfo loginInfo,
@PathVariable Long careerId,
@RequestBody @Valid CareerDetailReqDto request
) {
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
return CareerDetailResponse.success(HttpStatus.CREATED, "활동 기록을 성공적으로 생성했습니다.",
careerDetailService.createDetail(requestMember, request, careerId)
);
Expand All @@ -48,11 +49,11 @@ public CareerDetailResponse<BaseCareerDetailResponse> create(
@Parameter(name = "detailId", description = "활동 기록 Id, path variable 입니다.")
})
public CareerDetailResponse<Object> delete(
@Login LoginInfo loginInfo,
@PathVariable Long careerId,
@PathVariable Long detailId
) {
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
careerDetailService.deleteDetail(requestMember, careerId ,detailId);
return CareerDetailResponse.success(HttpStatus.OK, "활동 기록을 성공적으로 삭제했습니다.",null);
}
Expand All @@ -64,12 +65,12 @@ public CareerDetailResponse<Object> delete(
@Parameter(name = "detailId", description = "활동 기록 Id, path variable 입니다. ")
})
public CareerDetailResponse<BaseCareerDetailResponse> update(
@Login LoginInfo loginInfo,
@PathVariable Long careerId,
@PathVariable Long detailId,
@RequestBody @Valid CareerDetailUpdateReqDto request
){
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
return CareerDetailResponse.success(
HttpStatus.OK,
"활동 기록을 성공적으로 수정했습니다.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
import umc.kkijuk.server.introduce.common.BaseResponse;
import umc.kkijuk.server.introduce.controller.response.IntroduceListResponse;
import umc.kkijuk.server.introduce.controller.response.IntroduceResponse;
import umc.kkijuk.server.introduce.controller.response.MasterIntroduceResponse;
import umc.kkijuk.server.introduce.dto.*;
import umc.kkijuk.server.introduce.service.IntroduceService;
import umc.kkijuk.server.introduce.service.MasterIntroduceService;
import umc.kkijuk.server.login.argumentresolver.Login;
import umc.kkijuk.server.login.controller.dto.LoginInfo;
import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.member.service.MemberService;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand All @@ -33,38 +29,35 @@ public class IntroduceController {
private final MasterIntroduceService masterIntroduceService;
private final MemberService memberService;

private final Member requestMember = Member.builder()
.id(LoginUser.get().getId())
.build();

@PostMapping("/{recruitId}")
@Operation(summary = "자기소개서 생성")
public ResponseEntity<Object> save(
@Login LoginInfo loginInfo,
@PathVariable("recruitId") Long recruitId, @RequestBody IntroduceReqDto introduceReqDto){
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
IntroduceResponse introduceResponse = introduceService.saveIntro(requestMember, recruitId, introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 생성 완료", introduceResponse));
}

@GetMapping("detail/{introId}")
@Operation(summary = "자기소개서 개별 조회")
@GetMapping("detail/{introId}")
@Operation(summary = "자기소개서 개별 조회")
public ResponseEntity<Object> get(
@Login LoginInfo loginInfo,
@PathVariable("introId") Long introId){
Member requestMember = memberService.getById(loginInfo.getMemberId());
IntroduceResponse introduceResponse = introduceService.getIntro(requestMember, introId);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 조회 완료", introduceResponse));
@PathVariable("introId") Long introId){
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
IntroduceResponse introduceResponse = introduceService.getIntro(requestMember, introId);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 조회 완료", introduceResponse));
}

@GetMapping("list")
@Operation(summary = "자기소개서 목록 조회")
public ResponseEntity<Object> getList(@Login LoginInfo loginInfo){
Member requestMember = memberService.getById(loginInfo.getMemberId());
public ResponseEntity<Object> getList(){
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
List<IntroduceListResponse> introduceListResponses = introduceService.getIntroList(requestMember);
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -74,9 +67,9 @@ public ResponseEntity<Object> getList(@Login LoginInfo loginInfo){
@PatchMapping("/{introId}")
@Operation(summary = "자기소개서 수정")
public ResponseEntity<Object> update(
@Login LoginInfo loginInfo,
@PathVariable("introId") Long introId, @RequestBody IntroduceReqDto introduceReqDto) throws Exception {
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
IntroduceResponse introduceResponse = introduceService.updateIntro(requestMember, introId, introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -86,9 +79,9 @@ public ResponseEntity<Object> update(
@DeleteMapping("/{introId}")
@Operation(summary = "자기소개서 삭제")
public ResponseEntity<Object> delete(
@Login LoginInfo loginInfo,
@PathVariable("introId") Long introId){
Member requestMember = memberService.getById(loginInfo.getMemberId());
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
Long intro_Id = introduceService.deleteIntro(requestMember, introId);
return ResponseEntity
.status(HttpStatus.OK)
Expand All @@ -97,12 +90,10 @@ public ResponseEntity<Object> delete(

@GetMapping("/search")
@Operation(summary = "키워드로 자기소개서 문단 검색")
public ResponseEntity<Map<String, Object>> searchIntroduceByKeyword(@Login LoginInfo loginInfo, @RequestParam String keyword) {
Member requestMember = memberService.getById(loginInfo.getMemberId());
public ResponseEntity<Map<String, Object>> searchIntroduceByKeyword(@RequestParam String keyword) {
LoginUser loginUser = LoginUser.get();
Member requestMember = memberService.getById(loginUser.getId());
Map<String, Object> response = introduceService.searchIntroduceAndMasterByKeyword(keyword, requestMember);
return ResponseEntity.status(HttpStatus.OK).body(response);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ public class MasterIntroduceController {

@PostMapping
@Operation(summary = "마스터 자기소개서 생성")
public ResponseEntity<Object> saveMasterIntro(@Login LoginInfo loginInfo,
@RequestBody IntroduceReqDto introduceReqDto) throws Exception {
public ResponseEntity<Object> saveMasterIntro(@RequestBody IntroduceReqDto introduceReqDto) throws Exception {
LoginUser loginUser = LoginUser.get();
MasterIntroduceResponse masterIntroduceResponse =
masterIntroduceService.saveMasterIntro(loginInfo.getMemberId(), introduceReqDto);
masterIntroduceService.saveMasterIntro(loginUser.getId(), introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 생성 완료", masterIntroduceResponse));
}

@GetMapping
@Operation(summary = "마스터 자기소개서 조회")
public ResponseEntity<Object> getMasterIntro(@Login LoginInfo loginInfo){
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.getMasterIntro(loginInfo.getMemberId());
public ResponseEntity<Object> getMasterIntro(){
LoginUser loginUser = LoginUser.get();
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.getMasterIntro(loginUser.getId());
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 조회 완료", masterIntroduceResponse));
Expand All @@ -55,8 +56,9 @@ public ResponseEntity<Object> getMasterIntro(@Login LoginInfo loginInfo){
@PatchMapping
@Operation(summary = "마스터 자기소개서 수정")
public ResponseEntity<Object> updateMasterIntro(
@Login LoginInfo loginInfo, @RequestBody IntroduceReqDto introduceReqDto) throws Exception {
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.updateMasterIntro(loginInfo.getMemberId(), introduceReqDto);
@RequestBody IntroduceReqDto introduceReqDto) throws Exception {
LoginUser loginUser = LoginUser.get();
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.updateMasterIntro(loginUser.getId(), introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 수정 완료", masterIntroduceResponse));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public ResponseEntity<Boolean> confirmEmail(@RequestBody MemberEmailDto memberEm
summary = "내 정보 조회",
description = "마이페이지에서 내 정보들을 가져옵니다.")
@GetMapping("/myPage/info")
public ResponseEntity<MemberInfoResponse> getInfo(@Login LoginInfo loginInfo) {
// Long loginUser = LoginUser.get().getId();
MemberInfoResponse memberInfoResponse = memberService.getMemberInfo(loginInfo.getMemberId());
public ResponseEntity<MemberInfoResponse> getInfo() {
Long loginUser = LoginUser.get().getId();
MemberInfoResponse memberInfoResponse = memberService.getMemberInfo(loginUser);
return ResponseEntity
.status(HttpStatus.OK)
.body(memberInfoResponse);
Expand All @@ -76,52 +76,49 @@ public ResponseEntity<MemberInfoResponse> getInfo(@Login LoginInfo loginInfo) {
summary = "내 정보 수정",
description = "내 정보 수정 요청을 받아 성공/실패를 반환합니다.")
@PutMapping("/myPage/info")
public ResponseEntity<Boolean> changeMemberInfo(@Login LoginInfo loginInfo,
@RequestBody @Valid MemberInfoChangeDto memberInfoChangeDto) {
// Long loginUser = LoginUser.get().getId();
memberService.updateMemberInfo(loginInfo.getMemberId(), memberInfoChangeDto);
public ResponseEntity<Boolean> changeMemberInfo(@RequestBody @Valid MemberInfoChangeDto memberInfoChangeDto) {
Long loginUser = LoginUser.get().getId();
memberService.updateMemberInfo(loginUser, memberInfoChangeDto);
return ResponseEntity.ok(Boolean.TRUE);
}

@Operation(
summary = "관심분야 조회",
description = "마이페이지에서 관심분야를 조회합니다.")
@GetMapping("/myPage/field")
public ResponseEntity<MemberFieldResponse> getField(@Login LoginInfo loginInfo) {
// Long loginUser = LoginUser.get().getId();
List<String> memberField = memberService.getMemberField(loginInfo.getMemberId());
public ResponseEntity<MemberFieldResponse> getField() {
Long loginUser = LoginUser.get().getId();
List<String> memberField = memberService.getMemberField(loginUser);
return ResponseEntity.ok().body(new MemberFieldResponse(memberField));
}

@Operation(
summary = "관심분야 등록/수정",
description = "초기/마이페이지에서 관심분야를 등록/수정합니다.")
@PostMapping({"/field", "/myPage/field"})
public ResponseEntity<Boolean> postField(@Login LoginInfo loginInfo,
@RequestBody MemberFieldDto memberFieldDto) {
// Long loginUser = LoginUser.get().getId();
memberService.updateMemberField(loginInfo.getMemberId(), memberFieldDto);
public ResponseEntity<Boolean> postField(@RequestBody MemberFieldDto memberFieldDto) {
Long loginUser = LoginUser.get().getId();
memberService.updateMemberField(loginUser, memberFieldDto);
return ResponseEntity.ok(Boolean.TRUE);
}

@Operation(
summary = "비밀번호 변경",
description = "비밀번호를 변경합니다.")
@PostMapping("myPage/password")
public ResponseEntity<Boolean> changeMemberPassword(@Login LoginInfo loginInfo,
@RequestBody @Valid MemberPasswordChangeDto memberPasswordChangeDto){
// Long loginUser = LoginUser.get().getId();
memberService.changeMemberPassword(loginInfo.getMemberId(), memberPasswordChangeDto);
public ResponseEntity<Boolean> changeMemberPassword(@RequestBody @Valid MemberPasswordChangeDto memberPasswordChangeDto){
Long loginUser = LoginUser.get().getId();
memberService.changeMemberPassword(loginUser, memberPasswordChangeDto);
return ResponseEntity.ok(Boolean.TRUE);
}

@Operation(
summary = "내정보 조회 인증 화면 이메일 가져오기",
description = "내 정보를 조회 인증 화면에서 이메일을 가져옵니다.")
@GetMapping("/myPage")
public ResponseEntity<MemberEmailResponse> getEmail(@Login LoginInfo loginInfo) {
// Long loginUser = LoginUser.get().getId();
MemberEmailResponse memberEmailResponse = memberService.getMemberEmail(loginInfo.getMemberId());
public ResponseEntity<MemberEmailResponse> getEmail() {
Long loginUser = LoginUser.get().getId();
MemberEmailResponse memberEmailResponse = memberService.getMemberEmail(loginUser);
return ResponseEntity
.status(HttpStatus.OK)
.body(memberEmailResponse);
Expand All @@ -132,20 +129,19 @@ public ResponseEntity<MemberEmailResponse> getEmail(@Login LoginInfo loginInfo)
summary = "내정보 조회용 비밀번호 인증",
description = "내 정보를 조회하기 위해 비밀번호를 인증합니다.")
@PostMapping("/myPage")
public ResponseEntity<Boolean> myPagePasswordAuth(@Login LoginInfo loginInfo,
@RequestBody @Valid MyPagePasswordAuthDto myPagePasswordAuthDto){
// Long loginUser = LoginUser.get().getId();
memberService.myPagePasswordAuth(loginInfo.getMemberId(), myPagePasswordAuthDto);
public ResponseEntity<Boolean> myPagePasswordAuth(@RequestBody @Valid MyPagePasswordAuthDto myPagePasswordAuthDto){
Long loginUser = LoginUser.get().getId();
memberService.myPagePasswordAuth(loginUser, myPagePasswordAuthDto);
return ResponseEntity.ok(Boolean.TRUE);
}

@Operation(
summary = "회원 탈퇴",
description = "회원의 상태를 비활성화로 바꿉니다.")
@PatchMapping("/inactive")
public ResponseEntity<MemberStateResponse> memberInactivate(@Login LoginInfo loginInfo){
// Long loginUser = LoginUser.get().getId();
MemberStateResponse memberStateResponse = memberService.changeMemberState(loginInfo.getMemberId());
public ResponseEntity<MemberStateResponse> memberInactivate(){
Long loginUser = LoginUser.get().getId();
MemberStateResponse memberStateResponse = memberService.changeMemberState(loginUser);
return ResponseEntity
.status(HttpStatus.OK)
.body(memberStateResponse);
Expand Down
Loading

0 comments on commit b2af6c3

Please sign in to comment.