Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #62 api 응답 형식 변경, @parameter(hidden = true) 추가 #63

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6b34735
refactor: CommonResponse 성공응답 커스텀 가능하도록 수정
huncozyboy Oct 25, 2024
64ee53b
refactor: CommonResponse 성공응답 커스텀 수정
huncozyboy Oct 25, 2024
b6e8aa1
feat: schedule 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
e47f6ed
refactor: ScheduleController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
93ce729
refactor: MeetingController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
9ad97e7
refactor: MeetingAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
e7a019d
refactor: EventController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
854653d
refactor: EventAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
793bed8
refactor: 공통 성공 응답에 코드,메세지 커스텀 추가
huncozyboy Oct 25, 2024
26e4953
feat: user 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
6d7d0e9
refactor: UserAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
694bca0
refactor: UserController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
63f98ad
refactor: import 충돌 방지 성공 응답 수정
huncozyboy Oct 25, 2024
358a13d
feat: penalty 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
7e362fc
feat: penalty 도메인 에러 메세지 주석 추가
huncozyboy Oct 25, 2024
072b7f5
refactor: penaltyAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
4ba976f
refactor: penaltyUserController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
4f9f7f0
refactor: CommonResponse에 200을 상수로 넣어 코드 간결하게 변경
huncozyboy Oct 25, 2024
49e7aa9
feat: comment 도메인 에러 메세지 주석 추가
huncozyboy Oct 25, 2024
0ea901e
refactor: PostCommentController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
54f5c0a
refactor: NoticeCommentController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
1a0db57
feat: board 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
15ed3ed
refactor: NoticeAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
b9ed902
refactor: NoticeController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
1e5fca3
refactor: PostController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
068eb94
feat: attendance 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
c27f253
refactor: AttendanceAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
0b821ad
refactor: AttendanceController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
6c66f52
feat: account 도메인 에러 메세지 추가
huncozyboy Oct 25, 2024
8fb7ff3
refactor: AccountAdminController 관련 관련 성공 응답 수정
huncozyboy Oct 25, 2024
89c0a4b
refactor: AccountController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
6890a06
refactor: ReceiptAdminController 관련 성공 응답 수정
huncozyboy Oct 25, 2024
1d39d58
refactor: UserController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
c5cdb64
refactor: PostController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
4c9d5c1
refactor: PostCommentController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
1852675
refactor: penaltyUserController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
7820c3e
refactor: NoticeCommentController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
8c83096
refactor: NoticeAdminController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
0cf481a
refactor: MeetingAdminController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
3dd68ff
refactor: EventAdminController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
2a45216
refactor: AttendanceController 파라미터 스웨거 표시 안하도록 설정
huncozyboy Oct 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package leets.weeth.domain.account.presentation;

import static leets.weeth.domain.account.presentation.ResponseMessage.ACCOUNT_SAVE_SUCCESS;

import jakarta.validation.Valid;
import leets.weeth.domain.account.application.dto.AccountDTO;
import leets.weeth.domain.account.application.usecase.AccountUseCase;
Expand All @@ -20,6 +22,6 @@ public class AccountAdminController {
@PostMapping
public CommonResponse<Void> save(@RequestBody @Valid AccountDTO.Save dto) {
accountUseCase.save(dto);
return CommonResponse.createSuccess();
return CommonResponse.createSuccess(ACCOUNT_SAVE_SUCCESS.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package leets.weeth.domain.account.presentation;

import static leets.weeth.domain.account.presentation.ResponseMessage.ACCOUNT_FIND_SUCCESS;

import leets.weeth.domain.account.application.dto.AccountDTO;
import leets.weeth.domain.account.application.usecase.AccountUseCase;
import leets.weeth.global.common.response.CommonResponse;
Expand All @@ -18,6 +20,6 @@ public class AccountController {

@GetMapping("/{cardinal}")
public CommonResponse<AccountDTO.Response> find(@PathVariable Integer cardinal) {
return CommonResponse.createSuccess(accountUseCase.find(cardinal));
return CommonResponse.createSuccess(ACCOUNT_FIND_SUCCESS.getMessage(),accountUseCase.find(cardinal));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package leets.weeth.domain.account.presentation;

import static leets.weeth.domain.account.presentation.ResponseMessage.RECEIPT_DELETE_SUCCESS;
import static leets.weeth.domain.account.presentation.ResponseMessage.RECEIPT_SAVE_SUCCESS;

import jakarta.validation.Valid;
import leets.weeth.domain.account.application.dto.ReceiptDTO;
import leets.weeth.domain.account.application.usecase.ReceiptUseCase;
Expand All @@ -21,12 +24,12 @@ public class ReceiptAdminController {
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public CommonResponse<Void> save(@RequestPart @Valid ReceiptDTO.Save dto, @RequestPart(required = false) List<MultipartFile> images) {
receiptUseCase.save(dto, images);
return CommonResponse.createSuccess();
return CommonResponse.createSuccess(RECEIPT_SAVE_SUCCESS.getMessage());
}

@DeleteMapping("/{receiptId}")
public CommonResponse<Void> delete(@PathVariable Long receiptId) {
receiptUseCase.delete(receiptId);
return CommonResponse.createSuccess();
return CommonResponse.createSuccess(RECEIPT_DELETE_SUCCESS.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package leets.weeth.domain.account.presentation;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResponseMessage {
// AccountAdminController 관련
ACCOUNT_SAVE_SUCCESS("회비가 성공적으로 저장되었습니다."),

// AccountController 관련
ACCOUNT_FIND_SUCCESS("회비가 성공적으로 조회되었습니다."),

// ReceiptAdminController 관련
RECEIPT_SAVE_SUCCESS("영수증이 성공적으로 저장되었습니다."),
RECEIPT_DELETE_SUCCESS("영수증이 성공적으로 삭제되었습니다.");

private final String message;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package leets.weeth.domain.attendance.presentation;

import static leets.weeth.domain.attendance.presentation.ResponseMessage.ATTENDANCE_CLOSE_SUCCESS;

import leets.weeth.domain.attendance.application.usecase.AttendanceUseCase;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
Expand All @@ -20,6 +22,6 @@ public class AttendanceAdminController {
@PatchMapping
public CommonResponse<Void> close(@RequestParam LocalDate now, @RequestParam Integer cardinal) {
attendanceUseCase.close(now, cardinal);
return CommonResponse.createSuccess();
return CommonResponse.createSuccess(ATTENDANCE_CLOSE_SUCCESS.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package leets.weeth.domain.attendance.presentation;

import io.swagger.v3.oas.annotations.Parameter;
import leets.weeth.domain.attendance.application.dto.AttendanceDTO;
import leets.weeth.domain.attendance.application.usecase.AttendanceUseCase;
import leets.weeth.global.auth.annotation.CurrentUser;
Expand All @@ -9,6 +10,9 @@
import org.springframework.web.bind.annotation.*;

import static leets.weeth.domain.attendance.application.dto.AttendanceDTO.*;
import static leets.weeth.domain.attendance.presentation.ResponseMessage.ATTENDANCE_CHECKIN_SUCCESS;
import static leets.weeth.domain.attendance.presentation.ResponseMessage.ATTENDANCE_FIND_ALL_SUCCESS;
import static leets.weeth.domain.attendance.presentation.ResponseMessage.ATTENDANCE_FIND_SUCCESS;

@RestController
@RequiredArgsConstructor
Expand All @@ -18,18 +22,18 @@ public class AttendanceController {
private final AttendanceUseCase attendanceUseCase;

@PatchMapping
public CommonResponse<Void> checkIn(@CurrentUser Long userId, @RequestBody AttendanceDTO.CheckIn checkIn) throws AttendanceCodeMismatchException {
public CommonResponse<Void> checkIn(@Parameter(hidden = true) @CurrentUser Long userId, @RequestBody AttendanceDTO.CheckIn checkIn) throws AttendanceCodeMismatchException {
attendanceUseCase.checkIn(userId, checkIn.code());
return CommonResponse.createSuccess();
return CommonResponse.createSuccess(ATTENDANCE_CHECKIN_SUCCESS.getMessage());
}

@GetMapping
public CommonResponse<Main> find(@CurrentUser Long userId) {
return CommonResponse.createSuccess(attendanceUseCase.find(userId));
public CommonResponse<Main> find(@Parameter(hidden = true) @CurrentUser Long userId) {
return CommonResponse.createSuccess(ATTENDANCE_FIND_SUCCESS.getMessage(), attendanceUseCase.find(userId));
}

@GetMapping("/detail")
public CommonResponse<Detail> findAll(@CurrentUser Long userId) {
return CommonResponse.createSuccess(attendanceUseCase.findAll(userId));
public CommonResponse<Detail> findAll(@Parameter(hidden = true) @CurrentUser Long userId) {
return CommonResponse.createSuccess(ATTENDANCE_FIND_ALL_SUCCESS.getMessage(), attendanceUseCase.findAll(userId));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package leets.weeth.domain.attendance.presentation;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResponseMessage {
//AttendanceAdminController 관련
ATTENDANCE_CLOSE_SUCCESS("출석이 성공적으로 마감되었습니다."),

//AttendanceController 관련
ATTENDANCE_CHECKIN_SUCCESS("출석이 성공적으로 처리되었습니다."),
ATTENDANCE_FIND_SUCCESS("사용자의 출석 정보가 성공적으로 조회되었습니다."),
ATTENDANCE_FIND_ALL_SUCCESS("사용자의 상세 출석 정보가 성공적으로 조회되었습니다.");

private final String message;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import java.util.List;

import static leets.weeth.domain.board.domain.entity.enums.ResponseMessage.*;
import static leets.weeth.domain.board.presentation.ResponseMessage.*;

@RestController
@RequiredArgsConstructor
Expand All @@ -35,13 +35,13 @@ public CommonResponse<String> save(@RequestPart @Valid NoticeDTO.Save dto,
public CommonResponse<String> update(@PathVariable Long noticeId,
@RequestPart @Valid NoticeDTO.Update dto,
@RequestPart(value = "files", required = false) List<MultipartFile> files,
@CurrentUser Long userId) throws UserNotMatchException {
@Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
noticeUsecase.update(noticeId, dto, files, userId);
return CommonResponse.createSuccess(NOTICE_UPDATED_SUCCESS.getMessage());
}

@DeleteMapping("/{noticeId}")
public CommonResponse<String> delete(@PathVariable Long noticeId, @CurrentUser Long userId) throws UserNotMatchException {
public CommonResponse<String> delete(@PathVariable Long noticeId, @Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
noticeUsecase.delete(noticeId, userId);
return CommonResponse.createSuccess(NOTICE_DELETED_SUCCESS.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package leets.weeth.domain.board.presentation;


import static leets.weeth.domain.board.presentation.ResponseMessage.NOTICE_FIND_ALL_SUCCESS;
import static leets.weeth.domain.board.presentation.ResponseMessage.NOTICE_FIND_BY_ID_SUCCESS;

import leets.weeth.domain.board.application.dto.NoticeDTO;
import leets.weeth.domain.board.application.usecase.NoticeUsecase;
import leets.weeth.global.common.response.CommonResponse;
Expand All @@ -18,11 +21,11 @@ public class NoticeController {

@GetMapping
public CommonResponse<List<NoticeDTO.ResponseAll>> findNotices(@RequestParam(required = false) Long noticeId, @RequestParam Integer count) {
return CommonResponse.createSuccess(noticeUsecase.findNotices(noticeId, count));
return CommonResponse.createSuccess(NOTICE_FIND_ALL_SUCCESS.getMessage(), noticeUsecase.findNotices(noticeId, count));
}

@GetMapping("/{noticeId}")
public CommonResponse<NoticeDTO.Response> findNoticeById(@PathVariable Long noticeId) {
return CommonResponse.createSuccess(noticeUsecase.findNotice(noticeId));
return CommonResponse.createSuccess(NOTICE_FIND_BY_ID_SUCCESS.getMessage(), noticeUsecase.findNotice(noticeId));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package leets.weeth.domain.board.presentation;

import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import leets.weeth.domain.board.application.dto.PostDTO;
import leets.weeth.domain.board.application.usecase.PostUsecase;
Expand All @@ -13,7 +14,7 @@

import java.util.List;

import static leets.weeth.domain.board.domain.entity.enums.ResponseMessage.*;
import static leets.weeth.domain.board.presentation.ResponseMessage.*;

@RestController
@RequiredArgsConstructor
Expand All @@ -25,32 +26,32 @@ public class PostController {
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public CommonResponse<String> save(@RequestPart @Valid PostDTO.Save dto,
@RequestPart(value = "files", required = false) List<MultipartFile> files,
@CurrentUser Long userId) {
@Parameter(hidden = true) @CurrentUser Long userId) {
postUsecase.save(dto, files, userId);
return CommonResponse.createSuccess(POST_CREATED_SUCCESS.getMessage());
}

@GetMapping
public CommonResponse<List<PostDTO.ResponseAll>> findPosts(@RequestParam(required = false) Long postId, @RequestParam Integer count) {
return CommonResponse.createSuccess(postUsecase.findPosts(postId, count));
return CommonResponse.createSuccess(POST_FIND_ALL_SUCCESS.getMessage(), postUsecase.findPosts(postId, count));
}

@GetMapping("/{postId}")
public CommonResponse<PostDTO.Response> findPost(@PathVariable Long postId) {
return CommonResponse.createSuccess(postUsecase.findPost(postId));
return CommonResponse.createSuccess(POST_FIND_BY_ID_SUCCESS.getMessage(),postUsecase.findPost(postId));
}

@PatchMapping(value = "/{postId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public CommonResponse<String> update(@PathVariable Long postId,
@RequestPart @Valid PostDTO.Update dto,
@RequestPart(value = "files", required = false) List<MultipartFile> files,
@CurrentUser Long userId) throws UserNotMatchException {
@Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
postUsecase.update(postId, dto, files, userId);
return CommonResponse.createSuccess(POST_UPDATED_SUCCESS.getMessage());
}

@DeleteMapping("/{postId}")
public CommonResponse<String> delete(@PathVariable Long postId, @CurrentUser Long userId) throws UserNotMatchException {
public CommonResponse<String> delete(@PathVariable Long postId, @Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
postUsecase.delete(postId, userId);
return CommonResponse.createSuccess(POST_DELETED_SUCCESS.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package leets.weeth.domain.board.presentation;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResponseMessage {
//NoticeAdminController 관련
NOTICE_CREATED_SUCCESS("공지사항이 성공적으로 생성되었습니다."),
NOTICE_UPDATED_SUCCESS("공지사항이 성공적으로 수정되었습니다."),
NOTICE_DELETED_SUCCESS("공지사항이 성공적으로 삭제되었습니다."),
//NoticeController 관련
NOTICE_FIND_ALL_SUCCESS("공지사항 목록이 성공적으로 조회되었습니다."),
NOTICE_FIND_BY_ID_SUCCESS("공지사항이 성공적으로 조회되었습니다."),
//PostController 관련
POST_CREATED_SUCCESS("게시글이 성공적으로 생성되었습니다."),
POST_UPDATED_SUCCESS("게시글이 성공적으로 수정되었습니다."),
POST_DELETED_SUCCESS("게시글이 성공적으로 삭제되었습니다."),
POST_FIND_ALL_SUCCESS("게시글 목록이 성공적으로 조회되었습니다."),
POST_FIND_BY_ID_SUCCESS("게시글이 성공적으로 조회되었습니다.");

private final String message;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package leets.weeth.domain.comment.presentation;

import static leets.weeth.domain.comment.presentation.ResponseMessage.COMMENT_CREATED_SUCCESS;
import static leets.weeth.domain.comment.presentation.ResponseMessage.COMMENT_DELETED_SUCCESS;
import static leets.weeth.domain.comment.presentation.ResponseMessage.COMMENT_UPDATED_SUCCESS;

import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import leets.weeth.domain.comment.application.dto.CommentDTO;
import leets.weeth.domain.comment.application.usecase.NoticeCommentUsecase;
Expand All @@ -9,7 +14,6 @@
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import static leets.weeth.domain.comment.domain.entity.enums.ResponseMessage.*;

@RestController
@RequiredArgsConstructor
Expand All @@ -19,19 +23,22 @@ public class NoticeCommentController {
private final NoticeCommentUsecase noticeCommentUsecase;

@PostMapping
public CommonResponse<String> saveNoticeComment(@RequestBody @Valid CommentDTO.Save dto, @PathVariable Long noticeId, @CurrentUser Long userId) {
public CommonResponse<String> saveNoticeComment(@RequestBody @Valid CommentDTO.Save dto, @PathVariable Long noticeId,
@Parameter(hidden = true) @CurrentUser Long userId) {
noticeCommentUsecase.saveNoticeComment(dto, noticeId, userId);
return CommonResponse.createSuccess(COMMENT_CREATED_SUCCESS.getMessage());
}

@PatchMapping("{commentId}")
public CommonResponse<String> updateNoticeComment(@RequestBody @Valid CommentDTO.Update dto, @PathVariable Long noticeId, @PathVariable Long commentId, @CurrentUser Long userId) throws UserNotMatchException {
public CommonResponse<String> updateNoticeComment(@RequestBody @Valid CommentDTO.Update dto, @PathVariable Long noticeId,
@PathVariable Long commentId,@Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
noticeCommentUsecase.updateNoticeComment(dto, noticeId, commentId, userId);
return CommonResponse.createSuccess(COMMENT_UPDATED_SUCCESS.getMessage());
}

@DeleteMapping("{commentId}")
public CommonResponse<String> deleteNoticeComment(@PathVariable Long commentId, @CurrentUser Long userId) throws UserNotMatchException {
public CommonResponse<String> deleteNoticeComment(@PathVariable Long commentId,
@Parameter(hidden = true) @CurrentUser Long userId) throws UserNotMatchException {
noticeCommentUsecase.deleteNoticeComment(commentId, userId);
return CommonResponse.createSuccess(COMMENT_DELETED_SUCCESS.getMessage());
}
Expand Down
Loading
Loading