-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[게시글 생성/조회/수정/삭제] 지노 미션 제출합니다. (#45)
* feat: thymeleaf 추가, html 파일 templates 디렉토리로 이동 * feat: Test 주석추가 * feat: ArticleController 추가 * feat: Article 클래스 추가 * feat: 게시글 수정, 삭제 기능 구현 * refactor: 코드 리팩토링 * refactor: 함수명 수정 * refactor: Controller 메서드명 수정 * refactor: 코드 리팩토링 * refactor: 매서드 위치 수정 * refactor: 리뷰 반영 * refactor: 리뷰 반영 : setter 메서드명 번경 * refactor: 리뷰 반영, ArticleRepository.class update 메서드 삭제 * refactor: 리뷰 반영, ArticleRepository.class 수정에 따른 테스트 코드 삭제 * refactor: 리뷰 반영, controller ModelAnvView 메서드 내부에서 수정 * refactor: 테스트 코드 수정 * refactor 피드백 반영 * refactor 피드백 반영
- Loading branch information
1 parent
ca74828
commit 72e0dc0
Showing
21 changed files
with
465 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
package techcourse.myblog; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Controller | ||
@RestController | ||
public class HelloWorldController { | ||
@GetMapping("/helloworld") | ||
public String temp(String blogName) { | ||
return blogName; | ||
} | ||
|
||
@PostMapping("/helloworld") | ||
public String asd(@RequestBody String blogName) { | ||
return blogName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,72 @@ | ||
package techcourse.myblog.domain; | ||
|
||
import java.util.Objects; | ||
|
||
public class Article { | ||
private int id; | ||
private String title; | ||
private String coverUrl; | ||
private String contents; | ||
|
||
public Article(String title, String coverUrl, String contents) { | ||
this.title = title; | ||
this.coverUrl = coverUrl; | ||
this.contents = contents; | ||
} | ||
|
||
public boolean checkId(int id) { | ||
return this.id == id; | ||
} | ||
|
||
public void update(Article article) { | ||
this.title = article.title; | ||
this.coverUrl = article.coverUrl; | ||
this.contents = article.contents; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getCoverUrl() { | ||
return coverUrl; | ||
} | ||
|
||
public String getContents() { | ||
return contents; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Article{" + | ||
"id='" + id + '\'' + | ||
", title='" + title + '\'' + | ||
", coverUrl='" + coverUrl + '\'' + | ||
", contents='" + contents + '\'' + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Article article = (Article) o; | ||
return id == article.id && | ||
Objects.equals(title, article.title) && | ||
Objects.equals(coverUrl, article.coverUrl) && | ||
Objects.equals(contents, article.contents); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, title, coverUrl, contents); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
|
||
spring.devtools.livereload.enabled=true | ||
spring.devtools.restart.enabled=true | ||
spring.thymeleaf.cache=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
,--, | ||
,---._ ,----.. ,--. ,--, ,----.. ,---.'| | ||
.-- -.' \ ,---, .--.--. / / \ ,--.'| ,--.'| / / \ | | : ,---, ,----.. | ||
| | : ' .' \ / / '. / . : ,--,: : | ,--, | : / . : : : | ,`--.' | / / \ | ||
: ; | / ; '. | : /`. / . / ;. \,`--.'`| ' : ,---.'| : ' . / ;. \| ' : | : :| : : | ||
: |: : \ ; | |--` . ; / ` ;| : : | | | | : _' |. ; / ` ;; ; ' : | '. | ;. / | ||
| : :: | /\ \| : ;_ ; | ; \ ; |: | \ | : : : |.' |; | ; \ ; |' | |__ | : |. ; /--` | ||
: | : ' ;. :\ \ `. | : | ; | '| : ' '; | | ' ' ; :| : | ; | '| | :.'|' ' ;; | ; | ||
| ; || | ;/ \ \`----. \. | ' ' ' :' ' ;. ; ' | .'. |. | ' ' ' :' : ;| | || : | | ||
___ l ' : | \ \ ,'__ \ \ |' ; \; / || | | \ | | | : | '' ; \; / || | ./ ' : ;. | '___ | ||
/ /\ J :| | ' '--' / /`--' / \ \ ', / ' : | ; .' ' : | : ; \ \ ', / ; : ; | | '' ; : .'| | ||
/ ../ `..- ,| : : '--'. / ; : / | | '`--' | | ' ,/ ; : / | ,/ ' : |' | '/ : | ||
\ \ ; | | ,' `--'---' \ \ .' ' : | ; : ;--' \ \ .' '---' ; |.' | : / | ||
\ \ ,' `--'' `---` ; |.' | ,/ `---` '---' \ \ .' | ||
"---....--' '---' '---' `---` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.