Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b1a531f
소개를 위한 html파일 추가
pizzaa0930 Nov 4, 2025
26718ef
자기소개 작성
pizzaa0930 Nov 4, 2025
64943ac
refactor:static 디렉토리를 만들고 introduce 파일 이동
pizzaa0930 Nov 4, 2025
dd42cc5
refactor:깃허브의 예시코드로 내용 변경
pizzaa0930 Nov 4, 2025
a77937f
fix:Responsebody 삭제
pizzaa0930 Nov 4, 2025
0eae45b
refactor:name에 원하는 입력 받을 수 있게 수정
pizzaa0930 Nov 4, 2025
b624f9e
refactor:불필요한 "," 를 제거하여 예시대로 출력되도록 함
pizzaa0930 Nov 4, 2025
e7da805
feat:json으로 보낼 정보를 넣기 위해 java파일 생성
pizzaa0930 Nov 4, 2025
85907c4
fix:Responsebody 를 다시 넣고 새로 생성한 Info 파일 json으로 반환할 수 있게 수정
pizzaa0930 Nov 4, 2025
bd41897
refactor:경로를 article로 변경하고 GET요청 코드 추가
pizzaa0930 Nov 9, 2025
d0ef4bd
refactor:경로를 article로 변경하기 위해 클래스 추가
pizzaa0930 Nov 9, 2025
da803f4
feat: map생성
pizzaa0930 Nov 9, 2025
cbc4286
feat: put 메서드 생성
pizzaa0930 Nov 9, 2025
0f5453e
feat: delete 메서드 생성
pizzaa0930 Nov 9, 2025
a3afff3
fix: delete 메서드 생성에서 NO_CONTENT가 아니라 OK로 설정해놨던 것을 수정
pizzaa0930 Nov 9, 2025
60d4231
fix: 존재하지 않는 요청 반환에 대한 not_found 조건이 빠져있었다
pizzaa0930 Nov 9, 2025
c0ad65b
refactor: model 패키지를 만들고 이동
pizzaa0930 Nov 16, 2025
1d24157
feat: Board 클래스 추가
pizzaa0930 Nov 16, 2025
506ad17
feat: Member 클래스 추가
pizzaa0930 Nov 16, 2025
e86ebd9
feat: 리포지토리 작성
pizzaa0930 Nov 17, 2025
276a303
feat: 서비스 작성
pizzaa0930 Nov 17, 2025
b8f0a76
feat: 컨트롤러 작성
pizzaa0930 Nov 17, 2025
0392874
refactor: get,set메서드 오류 수정
pizzaa0930 Nov 17, 2025
8c45cc5
feat: post html작성
pizzaa0930 Nov 17, 2025
1775590
feat: 전체 뷰 반환하는 컨트롤러 추가
pizzaa0930 Nov 17, 2025
047ea4e
feat: sql경로 찾을 수 있는 코드 추가
pizzaa0930 Nov 21, 2025
b10898d
refactor: jdbc 템플릿 사용하여 DB연결할 수 있도록 리팩토링
pizzaa0930 Nov 24, 2025
5c06819
refactor:sql DB받을 수 있는 implementation 추가
pizzaa0930 Nov 24, 2025
3195137
refactor:Transactional추가
pizzaa0930 Nov 24, 2025
2d2f147
refactor:HTML뷰 반환을 위한 메서드 추가
pizzaa0930 Nov 24, 2025
822ab75
refactor:JDBC 리팩토링
pizzaa0930 Nov 24, 2025
ef325f5
refactor:게시글 메서드 추가
pizzaa0930 Nov 24, 2025
c3564b0
refactor:변수명 수정
pizzaa0930 Nov 24, 2025
bac3d9a
feat:예외 클래스 추가
pizzaa0930 Dec 1, 2025
c5cd8c0
refactor:예외 처리 내용 추가
pizzaa0930 Dec 1, 2025
4cfe6df
feat:예외 처리 핸들러 추가
pizzaa0930 Dec 1, 2025
4c82e78
refactor:jpa구조로 리팩토링
pizzaa0930 Dec 22, 2025
6431f59
refactor:Article 연관관계 추가
pizzaa0930 Dec 29, 2025
81e0915
refactor:Board 연관관계 추가에 따라 로직 수정
pizzaa0930 Dec 29, 2025
15b8e3c
feat:DTO 추가
pizzaa0930 Dec 29, 2025
4001ebc
feat:DTO 추가
pizzaa0930 Dec 29, 2025
7d21d68
feat:DTO 추가
pizzaa0930 Dec 29, 2025
d64bcbd
refactor:컨트롤러 리팩토링
pizzaa0930 Dec 29, 2025
774d20c
refactor:서비스로직 수정
pizzaa0930 Dec 29, 2025
06dffa0
refactor:인터페이스 기반으로 변경
pizzaa0930 Dec 29, 2025
0ac28f5
fix:메서드 명 수정
pizzaa0930 Dec 29, 2025
a9c4c92
feat:로그인 기능 담당 컨트롤러 추가
pizzaa0930 Jan 5, 2026
cf75e0b
feat:로그인 요청 dto추가
pizzaa0930 Jan 5, 2026
706ea3f
refactor:세션 인증 방식 추가
pizzaa0930 Jan 5, 2026
464544e
feat:회원가입 추가
pizzaa0930 Jan 5, 2026
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
26 changes: 14 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.5'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}
6 changes: 3 additions & 3 deletions src/main/java/com/example/bcsd/BcsdApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@SpringBootApplication
public class BcsdApplication {

public static void main(String[] args) {
SpringApplication.run(BcsdApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(BcsdApplication.class, args);
}

}
61 changes: 61 additions & 0 deletions src/main/java/com/example/bcsd/Controller/ArticleController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.example.bcsd.Controller;

import com.example.bcsd.Service.ArticleService;
import com.example.bcsd.dto.ArticleCreateRequest;
import com.example.bcsd.dto.ArticleUpdateRequest;
import com.example.bcsd.model.Article;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/articles")
public class ArticleController {

private final ArticleService articleService;

public ArticleController(ArticleService articleService) {
this.articleService = articleService;
}

@GetMapping
public ResponseEntity<List<Article>> getAllArticles() {
return ResponseEntity.ok(articleService.findAllArticles());
}

@GetMapping("/{id}")
public ResponseEntity<Article> getArticleById(@PathVariable Long id) {
return ResponseEntity.ok(articleService.findArticle(id));
}

@PostMapping
public ResponseEntity<Article> createArticle(@RequestBody ArticleCreateRequest request) {
Article article = articleService.createArticle(
request.getAuthorId(),
request.getBoardId(),
request.getTitle(),
request.getContent()
);
return ResponseEntity.ok(article);
}

@PutMapping("/{id}")
public ResponseEntity<Article> updateArticle(
@PathVariable Long id,
@RequestBody ArticleUpdateRequest request
) {
Article updated = articleService.updateArticle(
id,
request.getTitle(),
request.getContent()
);
return ResponseEntity.ok(updated);
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteArticle(@PathVariable Long id) {
articleService.deleteArticle(id);
return ResponseEntity.ok().build();
}
}
52 changes: 52 additions & 0 deletions src/main/java/com/example/bcsd/Controller/BoardController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.example.bcsd.Controller;

import com.example.bcsd.Service.BoardService;
import com.example.bcsd.model.Board;
import com.example.bcsd.dto.BoardCreateRequest;
import com.example.bcsd.dto.BoardUpdateRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/boards")
public class BoardController {

private final BoardService boardService;

public BoardController(BoardService boardService) {
this.boardService = boardService;
}

@GetMapping
public ResponseEntity<List<Board>> getAllBoards() {
return ResponseEntity.ok(boardService.findAllBoards());
}

@GetMapping("/{id}")
public ResponseEntity<Board> getBoard(@PathVariable Long id) {
return ResponseEntity.ok(boardService.findBoard(id));
}

@PostMapping
public ResponseEntity<Board> createBoard(@RequestBody BoardCreateRequest request) {
Board saved = boardService.createBoard(request.getName());
return ResponseEntity.ok(saved);
}

@PutMapping("/{id}")
public ResponseEntity<Board> updateBoard(
@PathVariable Long id,
@RequestBody BoardUpdateRequest request
) {
Board updated = boardService.updateBoard(id, request.getName());
return ResponseEntity.ok(updated);
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteBoard(@PathVariable Long id) {
boardService.deleteBoard(id);
return ResponseEntity.ok().build();
}
}
31 changes: 31 additions & 0 deletions src/main/java/com/example/bcsd/Controller/LoginController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.example.bcsd.Controller;

import com.example.bcsd.Service.MemberService;
import com.example.bcsd.dto.MemberLoginRequest;
import com.example.bcsd.model.Member;
import jakarta.servlet.http.HttpSession;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController {

private final MemberService memberService;

public LoginController(MemberService memberService) {
this.memberService = memberService;
}

@PostMapping
public ResponseEntity<Member> login(
@RequestBody MemberLoginRequest request,
HttpSession session
) {
Member member = memberService.login(request);

session.setAttribute("LOGIN_MEMBER_ID", member.getId());

return ResponseEntity.ok(member);
}
}
69 changes: 69 additions & 0 deletions src/main/java/com/example/bcsd/Controller/MemberController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.example.bcsd.Controller;

import com.example.bcsd.Service.MemberService;
import com.example.bcsd.dto.MemberCreateRequest;
import com.example.bcsd.dto.MemberLoginRequest;
import com.example.bcsd.dto.MemberUpdateRequest;
import com.example.bcsd.model.Member;
import jakarta.servlet.http.HttpSession;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/members")
public class MemberController {

private final MemberService memberService;
private static final String LOGIN_MEMBER_ID = "LOGIN_MEMBER_ID";

public MemberController(MemberService memberService) {
this.memberService = memberService;
}

@GetMapping
public ResponseEntity<List<Member>> findAll() {
return ResponseEntity.ok(memberService.findAllMembers());
}

@GetMapping("/{id}")
public ResponseEntity<Member> findOne(@PathVariable Long id) {
return ResponseEntity.ok(memberService.findMember(id));
}

@PostMapping
public ResponseEntity<Member> create(@RequestBody MemberCreateRequest request) {
return ResponseEntity.ok(memberService.createMember(request));
}

@PutMapping("/{id}")
public ResponseEntity<Member> update(
@PathVariable Long id,
@RequestBody MemberUpdateRequest request
) {
return ResponseEntity.ok(memberService.updateMember(id, request));
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> delete(@PathVariable Long id) {
memberService.deleteMember(id);
return ResponseEntity.noContent().build();
}

@PostMapping("/login")
public ResponseEntity<Member> login(
@RequestBody MemberLoginRequest request,
HttpSession session
) {
Member member = memberService.login(request);
session.setAttribute(LOGIN_MEMBER_ID, member.getId());
return ResponseEntity.ok(member);
}

@PostMapping("/logout")
public ResponseEntity<Void> logout(HttpSession session) {
session.invalidate();
return ResponseEntity.noContent().build();
}
}
31 changes: 31 additions & 0 deletions src/main/java/com/example/bcsd/Controller/PostViewController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.example.bcsd.Controller;

import com.example.bcsd.Service.ArticleService;
import com.example.bcsd.Service.MemberService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class PostViewController {

private final ArticleService articleService;
private final MemberService memberService;

public PostViewController(ArticleService articleService, MemberService memberService) {
this.articleService = articleService;
this.memberService = memberService;
}

@GetMapping("/posts")
public String posts(@RequestParam(required = false) Long boardId, Model model) {
model.addAttribute("articles", articleService.findAllArticles());
model.addAttribute("members", memberService.findAllMembers());
if (boardId != null) {
model.addAttribute("articlesByBoard", articleService.getArticlesByBoardId(boardId));
}
return "posts";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class ArticleCreateException extends RuntimeException {
public ArticleCreateException(Long authorId, Long boardId) {
super("게시물 생성 중 잘못된 참조입니다.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class ArticleNotFoundException extends RuntimeException {
public ArticleNotFoundException(Long id) {
super("해당 게시글을 찾을 수 없습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class ArticleUpdateException extends RuntimeException {
public ArticleUpdateException(Long authorId, Long boardId) {
super("참조가 불가능합니다");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class BoardDeleteException extends RuntimeException {
public BoardDeleteException(Long boardId) {
super("게시판에 게시물이 존재하여 삭제할 수 없습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class BoardNotFoundException extends RuntimeException {
public BoardNotFoundException(Long id) {
super("해당 게시판을 찾을 수 없습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.bcsd.Exception;

public class EmailConflictException extends RuntimeException {
public EmailConflictException(String email) {
super("이미 존재하는 이메일입니다: " + email);
}
}
Loading