Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 189e741

Browse files
committed
Make board
1 parent 2e5e6be commit 189e741

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

‎src/main/java/com/rest/api/controller/v1/board/BoardController.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public SingleResult<Board> boardInfo(@PathVariable String boardName) {
3434
return responseService.getSingleResult(boardService.findBoard(boardName));
3535
}
3636

37-
@ApiOperation(value = "게시판 글 리스트", notes = "게시판의 포스팅 정보를 조회한다.")
37+
@ApiOperation(value = "게시글 리스트", notes = "게시글 리스트를 조회한다.")
3838
@GetMapping(value = "/{boardName}/posts")
3939
public ListResult<Post> posts(@PathVariable String boardName) {
4040
return responseService.getListResult(boardService.findPosts(boardName));
@@ -43,15 +43,15 @@ public ListResult<Post> posts(@PathVariable String boardName) {
4343
@ApiImplicitParams({
4444
@ApiImplicitParam(name = "X-AUTH-TOKEN", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header")
4545
})
46-
@ApiOperation(value = "게시판 글 작성", notes = "게시판에 글을 작성한다.")
46+
@ApiOperation(value = "게시글 작성", notes = "게시글을 작성한다.")
4747
@PostMapping(value = "/{boardName}")
4848
public SingleResult<Post> post(@PathVariable String boardName, @Valid @ModelAttribute ParamsPost post) {
4949
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
5050
String uid = authentication.getName();
5151
return responseService.getSingleResult(boardService.writePost(uid, boardName, post));
5252
}
5353

54-
@ApiOperation(value = "게시판 글 상세", notes = "게시판 글 상세정보를 조회한다.")
54+
@ApiOperation(value = "게시글 상세", notes = "게시글 상세정보를 조회한다.")
5555
@GetMapping(value = "/post/{postId}")
5656
public SingleResult<Post> post(@PathVariable long postId) {
5757
return responseService.getSingleResult(boardService.getPost(postId));
@@ -60,7 +60,7 @@ public SingleResult<Post> post(@PathVariable long postId) {
6060
@ApiImplicitParams({
6161
@ApiImplicitParam(name = "X-AUTH-TOKEN", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header")
6262
})
63-
@ApiOperation(value = "게시판 글 수정", notes = "게시판의 글을 수정한다.")
63+
@ApiOperation(value = "게시글 수정", notes = "게시판의 글을 수정한다.")
6464
@PutMapping(value = "/post/{postId}")
6565
public SingleResult<Post> post(@PathVariable long postId, @Valid @ModelAttribute ParamsPost post) {
6666
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
@@ -71,7 +71,7 @@ public SingleResult<Post> post(@PathVariable long postId, @Valid @ModelAttribute
7171
@ApiImplicitParams({
7272
@ApiImplicitParam(name = "X-AUTH-TOKEN", value = "로그인 성공 후 access_token", required = true, dataType = "String", paramType = "header")
7373
})
74-
@ApiOperation(value = "게시판 글 삭제", notes = "게시판의 글을 삭제한다.")
74+
@ApiOperation(value = "게시글 삭제", notes = "게시글을 삭제한다.")
7575
@DeleteMapping(value = "/post/{postId}")
7676
public CommonResult deletePost(@PathVariable long postId) {
7777
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

‎src/main/java/com/rest/api/entity/User.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.rest.api.entity.common.CommonDateEntity;
56
import lombok.AllArgsConstructor;
67
import lombok.Builder;
78
import lombok.Getter;
@@ -23,7 +24,7 @@
2324
@AllArgsConstructor // 인자를 모두 갖춘 생성자를 자동으로 생성합니다.
2425
@Table(name = "user") // 'user' 테이블과 매핑됨을 명시
2526
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
26-
public class User implements UserDetails {
27+
public class User extendsCommonDateEntityimplements UserDetails {
2728
@Id // pk
2829
@GeneratedValue(strategy = GenerationType.IDENTITY)
2930
private Long msrl;

‎src/main/java/com/rest/api/service/board/BoardService.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
import com.rest.api.repo.board.BoardJpaRepo;
1212
import com.rest.api.repo.board.PostJpaRepo;
1313
import lombok.RequiredArgsConstructor;
14-
import lombok.extern.slf4j.Slf4j;
1514
import org.springframework.stereotype.Service;
1615

1716
import javax.transaction.Transactional;
1817
import java.util.List;
18+
import java.util.Optional;
1919

20-
@Slf4j
2120
@Service
2221
@Transactional
2322
@RequiredArgsConstructor
@@ -28,7 +27,7 @@ public class BoardService {
2827
private final UserJpaRepo userJpaRepo;
2928

3029
public Board findBoard(String boardName) {
31-
return boardJpaRepo.findByName(boardName);
30+
return Optional.ofNullable(boardJpaRepo.findByName(boardName)).orElseThrow(CResourceNotExistException::new);
3231
}
3332

3433
public List<Post> findPosts(String boardName) {

‎src/main/resources/application-local.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
logging:
22
level:
3-
root: debug
3+
root: info
44
com.rest.api: debug
55

66
spring:

‎src/main/resources/i18n/exception_ko.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ notOwner:
2424
msg: "해당 자원의 소유자가 아닙니다."
2525
resourceNotExist:
2626
code: "-1007"
27-
msg: "요청하신 자원이 존재 하지 않습니다."
27+
msg: "요청한 자원이 존재 하지 않습니다."

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /