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

[5기 이세희, 이중원] Spring Boot JPA 게시판 구현 미션 제출합니다. #274

Open
wants to merge 106 commits into
base: 세희,중원mission
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
8f4025a
#1 init: project
shoeone96 Nov 16, 2023
441bfe9
테스트입니다.
Sehee-Lee-01 Nov 16, 2023
a78f785
Merge branch 'main' of https://github.com/spring-comes-to-us/springbo…
shoeone96 Nov 16, 2023
34f4b79
테스트2입니다.
Sehee-Lee-01 Nov 16, 2023
a1738dd
테스트2입니다.
Sehee-Lee-01 Nov 16, 2023
a99ef1b
Merge branch 'main' of https://github.com/spring-comes-to-us/springbo…
shoeone96 Nov 16, 2023
83d5714
#2 feat: 엔티티 생성
Sehee-Lee-01 Nov 16, 2023
4e759bd
Delete build directory
Sehee-Lee-01 Nov 16, 2023
5ea2032
Delete .gradle directory
Sehee-Lee-01 Nov 16, 2023
b9daf38
Delete .idea directory
Sehee-Lee-01 Nov 16, 2023
6c006f5
Delete .DS_Store
Sehee-Lee-01 Nov 16, 2023
e2d0a4d
chore: .gitignore에 .idea/ 추가
Sehee-Lee-01 Nov 16, 2023
ff82c0c
chore: db 생성 시 default 유저 넣는 sql 작성
shoeone96 Nov 16, 2023
f31e85e
#3 feat: 반환 객체 통일하기 위한 Response class 생성
shoeone96 Nov 16, 2023
b709faa
#3 feat: 로직 상 예외를 발생시키기 위한 Custom Exception class 생성
shoeone96 Nov 16, 2023
6082617
#3 feat: 전역 예외처리를 위한 Exception Handler 세팅
shoeone96 Nov 16, 2023
ee63df4
refactor: exception 관련 내용 board 패키지로 이동
Sehee-Lee-01 Nov 16, 2023
a5c243a
chore: application.yaml 데이터 소스, jpa 설정
Sehee-Lee-01 Nov 16, 2023
3482633
#4 feat: PostDto 구현
Sehee-Lee-01 Nov 16, 2023
50f6f71
#4 feat: PostDto 컨버터 구현
Sehee-Lee-01 Nov 16, 2023
8794784
feat: 유저가 없을 때 에러 메시지 정의
Sehee-Lee-01 Nov 16, 2023
14621ee
fix: Response @Getter 설정
Sehee-Lee-01 Nov 16, 2023
3b62670
#4 feat: UserRepository 구현
Sehee-Lee-01 Nov 16, 2023
e0252e3
#4 feat: PostRepository 구현 및 PostService/PostController save 기능 구현
Sehee-Lee-01 Nov 16, 2023
a67657a
Auto stash before merge of "main" and "origin/main"
shoeone96 Nov 16, 2023
ff34236
conflict: 버전 충돌 ErrorMessage
shoeone96 Nov 16, 2023
0887c1a
chore: test 환경 분리
shoeone96 Nov 16, 2023
4ea0c15
#4 test: 정상적으로 글이 들어오는 컨트롤러 테스트
shoeone96 Nov 16, 2023
a6570dd
#4 test: 정상적으로 글이 들어오는 서비스 테스트
shoeone96 Nov 16, 2023
77a14e2
chore: test table 작성 및 검증 의존성 추가
shoeone96 Nov 16, 2023
052285e
#4 글 작성 시 발생할 수 있는 validation 항목 추가
shoeone96 Nov 16, 2023
6701616
#4 feat: binding result에 따른 검증 로직 컨트롤러에 추가
shoeone96 Nov 16, 2023
c28676a
chore: 에러 발생 시 로그 남기는 로직 추가
shoeone96 Nov 16, 2023
60a0c97
chore: Exception 멤버 변수들 final 로 선언
shoeone96 Nov 16, 2023
ac06b82
#4 feat: binding result 관련 에러 사항 추가
shoeone96 Nov 16, 2023
973c558
#5 feat: Post 조회용 dto 구현
Sehee-Lee-01 Nov 17, 2023
68f1e21
#5 feat: Post 페이지 조회 서비스 구현
Sehee-Lee-01 Nov 17, 2023
e3603d7
#5 feat: Post 페이지 조회 api 구현
Sehee-Lee-01 Nov 17, 2023
347ff16
#9 refactor: Post 페이지 조회 기능 N+1 문제 해결
Sehee-Lee-01 Nov 17, 2023
c815867
#6 feat: 게시글 단건 조회 api 작성
shoeone96 Nov 18, 2023
17566f3
#6 feat: 단건 조회 시 반환할 dto 작성
shoeone96 Nov 18, 2023
8036d3b
#6 feat: 게시글 단건 조회를 위한 서비스 로직 작성
shoeone96 Nov 18, 2023
a7a7eca
#6 feat: 단건 조회 시 게시글이 존재하지 않는 경우의 예외 메시지 추가
shoeone96 Nov 18, 2023
eac94d7
#6 feat: 단건 조회 시 반환하는 데이터 정보 record dto 작성
shoeone96 Nov 18, 2023
7d4dfa2
#6 refactor: 단건 조회 시 user 정보 가져올 때 쿼리가 두 번 나가는 문제 EntityGraph로 해결
shoeone96 Nov 18, 2023
d44f3e6
#7 feat: 게시글 수정 dto 구현
Sehee-Lee-01 Nov 18, 2023
a9391aa
#6 refactor: 게시글 단건 조회 dto에 userId 추가
Sehee-Lee-01 Nov 18, 2023
2a64530
#6 feat: 게시글 수정 시 작성자 불일치 예외 메시지 구현
Sehee-Lee-01 Nov 18, 2023
95b9732
#6 feat: 게시글 엔티티에 수정 메서드 구현
Sehee-Lee-01 Nov 18, 2023
8a6378a
#6 refactor: 유저 엔티티에 EqualsAndHashCode 추가
Sehee-Lee-01 Nov 18, 2023
ba4f41a
#6 feat: 게시글 수정 api 구현
Sehee-Lee-01 Nov 18, 2023
ae5fa99
#6 feat: 게시글 수정 서비스 로직 구현
Sehee-Lee-01 Nov 18, 2023
108c70f
#10 refactor: ResponseEntity를 사용해 status를 추가하는 방법으로 해결
shoeone96 Nov 21, 2023
9a12053
#8 chore: rest-docs 이용을 위한 의존성 및 build 세팅
shoeone96 Nov 21, 2023
d2692bf
#8 chore: rest-docs html 파일 변환을 위한 adoc 파일 생성
shoeone96 Nov 21, 2023
2fa505e
#8 test: rest-docs 생성 및 각 controller 정상 구동 api 테스트 작성
shoeone96 Nov 21, 2023
49a4958
#8 refactor: rest-docs 생성 중 coding convention field 명 camel case 미실시 수정
shoeone96 Nov 21, 2023
46557fc
chore: 통일 안된 Entity 및 Dto 에서의 ID 변수 타입 통일 필요
shoeone96 Nov 21, 2023
1f061a9
#11 feat: Post 생성 유효성 검사 로직 구현
Sehee-Lee-01 Nov 22, 2023
13ad54e
#11 feat: PostDto(생성) 유효성 검사 로직 구현
Sehee-Lee-01 Nov 22, 2023
2ca6a2c
#11 feat: PostUpdateDto(수정) 유효성 검사 로직 구현
Sehee-Lee-01 Nov 22, 2023
bd83f36
#11 feat: PostDetailResponseDto 유효성 검사 로직 구현
Sehee-Lee-01 Nov 22, 2023
e962e44
#11 feat: PostResponseDto 유효성 검사 로직 구현
Sehee-Lee-01 Nov 22, 2023
157dc09
#11 refactor: binding result error 검사 메서드 분리
Sehee-Lee-01 Nov 22, 2023
7b69b9d
#11 refactor: BindingException getMessage 구현
Sehee-Lee-01 Nov 22, 2023
66ec769
#11 feat: 유효성 검사 관련 ErrorMessage 추가
Sehee-Lee-01 Nov 22, 2023
f75c0f9
#11 feat: BindingException 핸들러 추가
Sehee-Lee-01 Nov 22, 2023
13ff128
#11 refactor: long을 wapper 클래스(Long)로 변경
Sehee-Lee-01 Nov 22, 2023
69acf0a
chore: 프로젝트 정리(사용하지 않는 import,등 제거
shoeone96 Nov 22, 2023
26ebf0d
refactor: BindingResult 추가하여 binding 실패 시 예외 발생시키는 로직 update api에 추가
shoeone96 Nov 22, 2023
2510704
#13 test: api controller 전체 테스트 및 edge case 테스트
shoeone96 Nov 22, 2023
1ba412c
#13 refactor: Post 업데이트할 때 유효성 검사 로직 추가
Sehee-Lee-01 Nov 23, 2023
f59424a
#13 test: PostService 레이어 CRUD 테스트 구현
Sehee-Lee-01 Nov 23, 2023
d3eda17
#13 refactor: PostControllerTest 클래스에 @Transactional 적용
Sehee-Lee-01 Nov 23, 2023
34eef46
refactor: parameterIzedTest 테스트 표기 명 생성
shoeone96 Nov 24, 2023
c42fa94
refactor: parameterIzedTest 테스트 표기 명 생성
shoeone96 Nov 24, 2023
05826c7
#13 test: 도메인 테스트 케이스 작성
shoeone96 Nov 24, 2023
661ba81
refactor: 메서드명 구체적으로 변경
Sehee-Lee-01 Nov 24, 2023
478bca4
refactor: 불필요한 예외 핸들러 삭제
Sehee-Lee-01 Nov 24, 2023
88523f3
refactor: BindingException 처리 로직 Validation 안으로 처리하도록 수정
Sehee-Lee-01 Nov 24, 2023
e8e7829
Update build.gradle
Sehee-Lee-01 Dec 1, 2023
3ff9bc5
refactor: 스키마 생성과 데이터 삽입 sql 분리 설정
Sehee-Lee-01 Dec 1, 2023
61d22fc
refactor: .gitignore에 HELP.md 포함하도록 설정
Sehee-Lee-01 Dec 1, 2023
6fa10aa
refactor: lombok testImplementation 의존성 삭제
Sehee-Lee-01 Dec 1, 2023
1095fbd
docs: README.md 불필요한 문구 삭제
Sehee-Lee-01 Dec 1, 2023
8c9b2f1
Merge branch 'main' of https://github.com/spring-comes-to-us/springbo…
Sehee-Lee-01 Dec 1, 2023
1470348
refactor: Post 생성 후 status 201 반환하도록 ResponseEntity 적용
Sehee-Lee-01 Dec 1, 2023
e70a179
refactor: PostDto를 PostCreateDto로 이름 변경
Sehee-Lee-01 Dec 1, 2023
2c112ec
Update src/main/java/com/example/board/dto/PostResponseDto.java
Sehee-Lee-01 Dec 1, 2023
cc326c9
Update src/main/java/com/example/board/exception/BaseException.java
Sehee-Lee-01 Dec 1, 2023
3cf530f
Update src/test/java/com/example/board/controller/PostControllerTest.…
Sehee-Lee-01 Dec 1, 2023
0a1d87d
refactor: Response.java 를 record 로 변경
shoeone96 Dec 1, 2023
ac3890a
Update src/main/java/com/example/board/service/PostService.java
shoeone96 Dec 1, 2023
85f75ee
refactor: Util 클래스 생성자 제한
shoeone96 Dec 1, 2023
1ad12bc
Update src/test/java/com/example/board/model/PostTest.java
shoeone96 Dec 1, 2023
943f484
refactor: test 개행 refactor
shoeone96 Dec 1, 2023
caf0ca2
Merge branch 'main' of https://github.com/spring-comes-to-us/springbo…
shoeone96 Dec 1, 2023
7a0f39b
refactor: GlobalExceptionHandler 개행 수정
Sehee-Lee-01 Dec 1, 2023
95be154
refactor: User 엔티티 EqualsAndHashCode callSuper=true로 설정
Sehee-Lee-01 Dec 1, 2023
3ec250a
#16 chore:docker redis 세팅
shoeone96 Dec 2, 2023
b49186f
#16 chore: Redis Template 설정
shoeone96 Dec 2, 2023
dff1bc6
#16 feat: PostCounter 작성
shoeone96 Dec 2, 2023
6c1dcdc
#16 feat: Redis를 이용한 PostCountRepository 작성
shoeone96 Dec 2, 2023
5e95e7d
#16 feat: 유저가 글 작성 시 Redis에 값 업데이트할 Service로직 작성
shoeone96 Dec 2, 2023
6eaf5b2
#16 feat: 글 작성 로직에서 상황 별 글 작성 제한 로직에 따라 발생할 Exception 추가
shoeone96 Dec 2, 2023
5c2b46a
#16 refactor: post 작성 메서드에 user별 post count를 체크할 redis 로직 추가
shoeone96 Dec 2, 2023
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
Prev Previous commit
Next Next commit
#16 feat: 글 작성 로직에서 상황 별 글 작성 제한 로직에 따라 발생할 Exception 추가
shoeone96 committed Dec 2, 2023
commit 6eaf5b2bc50be4a475f0a09d8912c7aa6513ab5e
4 changes: 3 additions & 1 deletion src/main/java/com/example/board/exception/ErrorMessage.java
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@ public enum ErrorMessage {
POST_NOT_FOUND(2000, HttpStatus.NOT_FOUND, "찾으시는 게시글이 없습니다."),
WRITER_NOT_MATCHED(2001, HttpStatus.BAD_REQUEST, "작성자가 일치하지 않습니다."),
WRONG_TITLE_VALUE(2002, HttpStatus.BAD_REQUEST, "게시글 제목은 1자~20자 이내로 작성해주십시오."),
WRONG_CONTENTS_VALUE(2003, HttpStatus.BAD_REQUEST, "게시글 내용을 작성해주십시오.");
WRONG_CONTENTS_VALUE(2003, HttpStatus.BAD_REQUEST, "게시글 내용을 작성해주십시오."),
OVER_MAX_POST_PER_DAY(2004, HttpStatus.BAD_REQUEST, "하루에 작성할 수 있는 최대 게시글 개수를 초과하였습니다."),
OVER_MAX_POST_PER_MINUTE(2005, HttpStatus.BAD_REQUEST, "1분 간 5개 이상의 글을 작성할 수 없습니다.");

private final int code;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 1xxx, 2xxx 등의 코드를 정의해서 사용하시면서 기대하신 이점이 무엇일까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/prgrms-be-devcourse/springboot-board-jpa/pull/274/files#r1410699823

참고해주시면 감사하겠습니다! 위는 제 생각이니 중원님 의견도 들어보면 좋을 것 같습니다!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오류코드를 프론트와 협업한다고 생각했을 때 구분할 수 있는 좋은 수단이라고 생각해서 이 방식을 차용했습니다!
코드 번호를 통해 어떤 상황에서 어떤 오류가 나오는지 프론트와 백엔드 모두 쉽게 체크할 수 있는 규약이라고 생각했습니다

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프론트와의 규약이라고 생각하니 이해가 되네요!

private final HttpStatus httpStatus;