Skip to content

[조재민_BackEnd] 11주차 과제 제출합니다#32

Open
JJM3485 wants to merge 38 commits intoBCSDLab-Edu:mainfrom
JJM3485:main
Open

[조재민_BackEnd] 11주차 과제 제출합니다#32
JJM3485 wants to merge 38 commits intoBCSDLab-Edu:mainfrom
JJM3485:main

Conversation

@JJM3485
Copy link

@JJM3485 JJM3485 commented Nov 9, 2025

실습에 있던 내용을 구현했습니다. 혹시나 구현이 안된 부분이 있거나 조금 더 효율적으로 할 수 있는 방안이 있으면 알려주시면 감사하겠습니다.

@JJM3485
Copy link
Author

JJM3485 commented Nov 16, 2025

6주차 내용을 완료했습니다. 제 나름대로 MVC를 분류했는데 수정할 부분 있으면 알려주시면 감사하겠습니다.

@JJM3485 JJM3485 changed the title [조재민_BackEnd] 5주차 과제 제출합니다 [조재민_BackEnd] 6주차 과제 제출합니다 Nov 16, 2025
@JJM3485
Copy link
Author

JJM3485 commented Nov 23, 2025

7주차 과제를 완성했습니다. 개인적으로 @JsonProperty을 사용하는 건 코드를 확인할 때 조금 혼란이 있을 것 같지만 그래도 이번에 알게 된 어노테이션을 사용해보고 싶어 추가하게 되었습니다. 부족한 부분이 있으면 피드백 부탁드립니다.

@JJM3485 JJM3485 changed the title [조재민_BackEnd] 6주차 과제 제출합니다 [조재민_BackEnd] 7주차 과제 제출합니다 Nov 23, 2025
Copy link

@taejinn taejinn left a comment

Choose a reason for hiding this comment

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

7주차 과제 진행하시느라 수고많으셨습니다. 👍

Comment on lines +27 to +53
public Article findById(Long id) {
return articles.get(id);
String sql = "SELECT * FROM article WHERE id = ?";
List<Article> result = jdbcTemplate.query(sql, articleRowMapper(), id);
return result.isEmpty() ? null : result.get(0);
Copy link

Choose a reason for hiding this comment

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

만약에 전달되는 id가 null이면 jdbc에서 예외를 던지므로 null 체크가 있으면 좋을 듯 합니다.

Comment on lines 10 to 33
@Repository
public class BoardRepository {

private final Map<Long, Board> boards = new HashMap<>();
private final AtomicLong idCount = new AtomicLong();
private final JdbcTemplate jdbcTemplate;

public Board save(Board board) {
if (board.getId() == null) {
long newId = idCount.incrementAndGet();
board.setId(newId);
}
boards.put(board.getId(), board);
return board;
public BoardRepository(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}

public Board findById(Long id) {
return boards.get(id);
String sql = "SELECT * FROM board WHERE id = ?";
List<Board> result = jdbcTemplate.query(sql, boardRowMapper(), id);
return result.isEmpty() ? null : result.get(0);
}

@PostConstruct
public void initData() {
Board board1 = new Board("자유게시판");
save(board1);

Board board2 = new Board("유자게시판");
save(board2);
private RowMapper<Board> boardRowMapper() {
return (rs, rowNum) -> {
Board board = new Board();
board.setId(rs.getLong("id"));
board.setName(rs.getString("name"));
return board;
};
}
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

게시판 생성/제거도 구현해보시면 좋겠습니다.

this.jdbcTemplate = jdbcTemplate;
}

public Article insert(Article article) {
Copy link

Choose a reason for hiding this comment

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

insert보다 save를 사용하는 것이 좋을 것 같습니다.

Copy link

Choose a reason for hiding this comment

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

다른 코드들에서도 같은 기능인 메서드들 이름을 통일시키면 좋겠습니다.

public String getPostsView(Model model) {
List<ArticleResponseDTO> articles = articleService.findAllArticles();
public String getPostsView(@RequestParam(required = false) Long boardId, Model model) {
List<Article> articles = articleService.findAllArticles(boardId);
Copy link

Choose a reason for hiding this comment

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

findAllArticles 네이밍도 좋지만, getAllArticles도 좋은 것 같습니다.

</li>
</ul>
</body>
</html> No newline at end of file
Copy link

Choose a reason for hiding this comment

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

모든 파일에서 EOF가 발생하고 있습니다.
아래 주소에서 확인 후 수정하시면 될 것 같습니다.

https://dream-and-develop.tistory.com/202

@JJM3485 JJM3485 changed the title [조재민_BackEnd] 7주차 과제 제출합니다 [조재민_BackEnd] 8주차 과제 제출합니다 Nov 30, 2025
@JJM3485
Copy link
Author

JJM3485 commented Nov 30, 2025

8주차 과제를 진행했습니다. 예외처리 부분을 이런식으로 하는게 맞는지 아직 확신이 들지 않아서 부족한 부분이 있으면 피드백 부탁드립니다.

Copy link

@taejinn taejinn left a comment

Choose a reason for hiding this comment

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

수고하셨습니다.

@@ -67,9 +107,11 @@ public Article updateArticle(Long id, ArticleRequestDTO request) {
@Transactional
public Article deleteArticle(Long id) {
Article existArticle = articleRepository.findById(id);
Copy link

Choose a reason for hiding this comment

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

게시글이 없으면 null을 반환하여 처리하는 것 보다, 게시글이 없더라도 빈 배열을 반환시켜 배열의 길이로 판단하면 좋을 것 같습니다.


@Transactional
public Board createBoard(Board board) {
if (board.getName() == null) {
Copy link

Choose a reason for hiding this comment

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

게시판 이름이 띄어쓰기로 시작하거나 " " 이렇게 null은 아니지만 공백으로만 이루어져 있다면 빈 문자열로 처리해야할지 고민해보면 좋을 것 같습니다.

Comment on lines +66 to +78
if (request.title() == null || request.content() == null ||
request.authorId() == null || request.boardId() == null) {
throw new AllException(HttpStatus.BAD_REQUEST, "필수 값이 누락되었습니다.");
}

if (memberRepository.findById(request.authorId()) == null) {
throw new AllException(HttpStatus.BAD_REQUEST, "존재하지 않는 사용자입니다.");
}

if (boardRepository.findById(request.boardId()) == null) {
throw new AllException(HttpStatus.BAD_REQUEST, "존재하지 않는 게시판입니다.");
}

Copy link

Choose a reason for hiding this comment

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

null을 직접 검사하는 것 보다 isEmpty를 사용해보는게 좋을 것 같다고 생각합니다. 어떻게 생각하시나요?

@JJM3485 JJM3485 changed the title [조재민_BackEnd] 8주차 과제 제출합니다 [조재민_BackEnd] 9주차 과제 제출합니다 Dec 21, 2025
@JJM3485
Copy link
Author

JJM3485 commented Dec 21, 2025

9주차입니다. 엔티티와 레포지터리 부분을 주로 변경했습니다.

Copy link

@taejinn taejinn left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 작성해주신 부분 모두 잘 읽었습니다.

Comment on lines 27 to 31
if (member.getName() == null || member.getName().trim().isEmpty() ||
member.getEmail() == null || member.getEmail().trim().isEmpty() ||
member.getPassword() == null || member.getPassword().trim().isEmpty()) {
throw new AllException(HttpStatus.BAD_REQUEST, "필수 값이 누락되었거나 공백입니다.");
}
Copy link

Choose a reason for hiding this comment

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

지금도 좋으나, 조금 더 보기 좋게 if 문을 나누거나 다른 방식으로 진행하면 더 좋을 듯 합니다!

@JJM3485
Copy link
Author

JJM3485 commented Dec 28, 2025

10주차 부분 코딩 완료했습니다.

@JJM3485 JJM3485 changed the title [조재민_BackEnd] 9주차 과제 제출합니다 [조재민_BackEnd] 10주차 과제 제출합니다 Dec 28, 2025
@JJM3485 JJM3485 changed the title [조재민_BackEnd] 10주차 과제 제출합니다 [조재민_BackEnd] 11주차 과제 제출합니다 Jan 4, 2026
@JJM3485
Copy link
Author

JJM3485 commented Jan 4, 2026

11주차 부분입니다. JWT 방식으로 로그인을 구현하였습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants