diff --git a/src/main/java/com/smunity/server/domain/course/controller/CourseController.java b/src/main/java/com/smunity/server/domain/course/controller/CourseController.java index 3320bf8..69a3a35 100644 --- a/src/main/java/com/smunity/server/domain/course/controller/CourseController.java +++ b/src/main/java/com/smunity/server/domain/course/controller/CourseController.java @@ -30,12 +30,6 @@ public ResponseEntity> readCourses(@AuthMem return ResponseEntity.ok(responseDto); } - @PostMapping("/upload") - public ResponseEntity> uploadCourses(@AuthMember Long memberId, @RequestBody @Valid AuthRequestDto requestDto) { - ResultResponseDto responseDto = courseCommandService.createCourses(memberId, requestDto); - return ResponseEntity.status(HttpStatus.CREATED).body(responseDto); - } - @GetMapping("/credit") public ResponseEntity readCoursesCredit(@AuthMember Long memberId) { CreditResponseDto responseDto = courseQueryService.readCoursesCredit(memberId); @@ -47,4 +41,10 @@ public ResponseEntity> readCultureCourses( ResultResponseDto responseDto = courseQueryService.readCultureCourses(memberId, domain); return ResponseEntity.ok(responseDto); } + + @PostMapping("/upload") + public ResponseEntity> uploadCourses(@AuthMember Long memberId, @RequestBody @Valid AuthRequestDto requestDto) { + ResultResponseDto responseDto = courseCommandService.createCourses(memberId, requestDto); + return ResponseEntity.status(HttpStatus.CREATED).body(responseDto); + } } diff --git a/src/main/java/com/smunity/server/domain/member/controller/MemberController.java b/src/main/java/com/smunity/server/domain/member/controller/MemberController.java index b7987fe..f166f7e 100644 --- a/src/main/java/com/smunity/server/domain/member/controller/MemberController.java +++ b/src/main/java/com/smunity/server/domain/member/controller/MemberController.java @@ -44,12 +44,6 @@ public ResponseEntity readMemberInfo(@AuthMember Long mem return ResponseEntity.ok(responseDto); } - @DeleteMapping("/me") - public ResponseEntity deleteMember(@AuthMember Long memberId) { - memberCommandService.deleteMember(memberId); - return ResponseEntity.noContent().build(); - } - @PutMapping("/me") public ResponseEntity updateMember(@AuthMember Long memberId, @RequestBody @Valid AuthRequestDto requestDto) { MemberInfoResponseDto responseDto = memberCommandService.updateMember(memberId, requestDto); @@ -73,4 +67,10 @@ public ResponseEntity changePasswordByAuth(@AuthVerified MemberInfoResponseDto responseDto = memberCommandService.changePasswordByAuth(memberName, requestDto); return ResponseEntity.ok(responseDto); } + + @DeleteMapping("/me") + public ResponseEntity deleteMember(@AuthMember Long memberId) { + memberCommandService.deleteMember(memberId); + return ResponseEntity.noContent().build(); + } } diff --git a/src/main/java/com/smunity/server/domain/member/service/MemberCommandService.java b/src/main/java/com/smunity/server/domain/member/service/MemberCommandService.java index cb4aa09..8d6c2ee 100644 --- a/src/main/java/com/smunity/server/domain/member/service/MemberCommandService.java +++ b/src/main/java/com/smunity/server/domain/member/service/MemberCommandService.java @@ -36,10 +36,6 @@ public MemberInfoResponseDto updateMember(Long memberId, AuthRequestDto requestD return MemberInfoResponseDto.from(member); } - public void deleteMember(Long memberId) { - memberRepository.deleteById(memberId); - } - public MemberInfoResponseDto changePassword(Long memberId, ChangePasswordRequestDto requestDto) { Member member = memberRepository.findById(memberId).orElseThrow(() -> new GeneralException(ErrorCode.MEMBER_NOT_FOUND)); String newEncodedPw = passwordEncoder.encode(requestDto.password()); @@ -61,4 +57,9 @@ public MemberInfoResponseDto changePasswordByAuth(String username, ChangePasswor Member member = memberRepository.findByUsername(username).orElseThrow(() -> new GeneralException(ErrorCode.MEMBER_NOT_FOUND)); return changePassword(member.getId(), requestDto); } + + public void deleteMember(Long memberId) { + Member member = memberRepository.findById(memberId).orElseThrow(() -> new GeneralException(ErrorCode.MEMBER_NOT_FOUND)); + memberRepository.delete(member); + } } diff --git a/src/main/java/com/smunity/server/domain/question/controller/QuestionController.java b/src/main/java/com/smunity/server/domain/question/controller/QuestionController.java index 98b269e..eb1607e 100644 --- a/src/main/java/com/smunity/server/domain/question/controller/QuestionController.java +++ b/src/main/java/com/smunity/server/domain/question/controller/QuestionController.java @@ -34,17 +34,17 @@ public ResponseEntity> readQuestions( return ResponseEntity.ok(responseDtoPage); } - @PostMapping - public ResponseEntity createQuestion(@AuthMember Long memberId, @RequestBody @Valid QuestionRequestDto requestDto) { - QuestionResponseDto responseDto = questionCommandService.createQuestion(memberId, requestDto); - return ResponseEntity.status(HttpStatus.CREATED).body(responseDto); - } - @GetMapping("/{questionId}") public ResponseEntity readQuestion(@AuthMember Long memberId, @PathVariable Long questionId) { QuestionReadResponseDto responseDto = questionQueryService.readQuestion(memberId, questionId); return ResponseEntity.ok(responseDto); } + + @PostMapping + public ResponseEntity createQuestion(@AuthMember Long memberId, @RequestBody @Valid QuestionRequestDto requestDto) { + QuestionResponseDto responseDto = questionCommandService.createQuestion(memberId, requestDto); + return ResponseEntity.status(HttpStatus.CREATED).body(responseDto); + } @PutMapping("/{questionId}") public ResponseEntity updateQuestion( diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index ef5ede2..97f2f65 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:h2:file:~/db + url: jdbc:h2:file:~/db/smunity username: sa password: driver-class-name: org.h2.Driver