-
Notifications
You must be signed in to change notification settings - Fork 0
Harry #8
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
Open
minkukjo
wants to merge
6
commits into
review/kotlin
Choose a base branch
from
harry
base: review/kotlin
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Harry #8
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,41 @@ | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| plugins { | ||
| id("org.springframework.boot") version "2.3.3.RELEASE" | ||
| id("io.spring.dependency-management") version "1.0.10.RELEASE" | ||
| kotlin("jvm") version "1.3.72" | ||
| kotlin("plugin.spring") version "1.3.72" | ||
| kotlin("plugin.jpa") version "1.3.72" | ||
| } | ||
|
|
||
| group = "me.harry" | ||
| version = "0.0.1-SNAPSHOT" | ||
| java.sourceCompatibility = JavaVersion.VERSION_11 | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
| implementation("org.springframework.boot:spring-boot-starter-web") | ||
| implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
| implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
| implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | ||
| runtimeOnly("com.h2database:h2") | ||
| runtimeOnly("mysql:mysql-connector-java") | ||
| testImplementation("org.springframework.boot:spring-boot-starter-test") { | ||
| exclude(group = "org.junit.vintage", module = "junit-vintage-engine") | ||
| } | ||
| } | ||
|
|
||
| tasks.withType<Test> { | ||
| useJUnitPlatform() | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile> { | ||
| kotlinOptions { | ||
| freeCompilerArgs = listOf("-Xjsr305=strict") | ||
| jvmTarget = "11" | ||
| } | ||
| } |
Binary file not shown.
This file contains hidden or 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,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 @@ | ||
| rootProject.name = "study" |
This file contains hidden or 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,11 @@ | ||
| package me.harry.study | ||
|
|
||
| import org.springframework.boot.autoconfigure.SpringBootApplication | ||
| import org.springframework.boot.runApplication | ||
|
|
||
| @SpringBootApplication | ||
| class StudyApplication | ||
|
|
||
| fun main(args: Array<String>) { | ||
| runApplication<StudyApplication>(*args) | ||
| } |
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/me/harry/study/controller/BoardController.kt
This file contains hidden or 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,37 @@ | ||
| package me.harry.study.controller | ||
|
|
||
| import me.harry.study.model.Board | ||
| import me.harry.study.payload.BoardRequest | ||
| import me.harry.study.service.BoardService | ||
| import me.harry.study.service.UserService | ||
| 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.RequestMapping | ||
| import org.springframework.web.bind.annotation.RequestParam | ||
| import org.springframework.web.bind.annotation.RestController | ||
|
|
||
| @RestController | ||
| @RequestMapping("/board") | ||
| class BoardController( | ||
| val boardService: BoardService, | ||
| val userService: UserService | ||
| ) { | ||
|
|
||
| @PostMapping | ||
| fun createBoard(@RequestBody boardRequest: BoardRequest, @RequestParam name:String):String { | ||
| val userByName = userService.getUserByName(name) | ||
| val board = Board( | ||
| title = boardRequest.title, | ||
| content = boardRequest.content, | ||
| user = userByName) | ||
| boardService.createBoard(board) | ||
| return "성고옹!" | ||
| } | ||
|
|
||
| @GetMapping | ||
| fun getBoards(@RequestParam name:String): List<Board> { | ||
| return boardService.getBoards(name) | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컨트롤러에서 모든 로직을 처리하는 것은 아름답지 않네요
Service 쪽으로 로직을 옮기는게 맞는 것 같습니다