-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feat/#33 Project API #37
Conversation
- ProjectService.updateProjectValues์ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ณ๊ฒฝํ์ต๋๋ค.
- ๊ณตํต ์๋ต ๊ท๊ฒฉ์ธ ApiCommonResponse๋ฅผ ๊ตฌํํ์ต๋๋ค.
- Project API Controller๋ฅผ ๊ตฌํํ์ต๋๋ค. (URI: `/v1/projects`) - GET `/{name}`: ํ๋ก์ ํธ ์กฐํ - POST `/`: ํ๋ก์ ํธ ์์ฑ - PUT `/{id}`: ํ๋ก์ ํธ ์์ - DELETE `/{id}`: ํ๋ก์ ํธ ์ ๊ฑฐ
- `@WebMvcTest` ๊ธฐ๋ฐ ProjectController ํ ์คํธ๋ฅผ ์งํํ์ต๋๋ค.
- ProjectService MockBean ์ด๋
logbat/src/test/java/info/logbat/domain/common/ControllerTestSupport.java
Show resolved
Hide resolved
logbat/src/test/java/info/logbat/domain/project/presentation/ProjectControllerTest.java
Show resolved
Hide resolved
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.
๐
public static ApiCommonResponse<Void> createFailResponse(HttpStatus httpStatus, | ||
String message) { | ||
return new ApiCommonResponse<>(httpStatus.value(), message); | ||
} |
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.
๊ณตํต ์๋ฌ ํธ๋ค๋ฌ๋ ๋์ค์ ๋ง๋ค์ด์
์ด์์ ์ฒดํฌ๋ฐ์ค ์ฑ์์ฃผ์ธ์~ |
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.
์ข์์~
@PostMapping | ||
public ResponseEntity<ApiCommonResponse<ProjectCommonResponse>> create( | ||
@RequestBody ProjectCreateRequest request) { | ||
ApiCommonResponse<ProjectCommonResponse> response = ApiCommonResponse.createApiResponse( | ||
HttpStatus.CREATED, "Success", projectService.createProject(request.name())); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(response); | ||
} |
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.
๋จ์ํ status๋ฅผ CREATED๋ก ์ค์ ํ๋ ์์ ์ด๋ผ๋ฉด
@ResponseStatus(HttpStatus.CREATED)
๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ์ด๋จ๊น์?!!
* chore: ๋ฉ์๋ ํ๋ผ๋ฏธํฐ ๋ณ๊ฒฝ - ProjectService.updateProjectValues์ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ณ๊ฒฝํ์ต๋๋ค. * feat: ๊ณตํต ์๋ต ๊ท๊ฒฉ ๊ตฌํ - ๊ณตํต ์๋ต ๊ท๊ฒฉ์ธ ApiCommonResponse๋ฅผ ๊ตฌํํ์ต๋๋ค. * feat: Project Controller ๊ตฌํ - Project API Controller๋ฅผ ๊ตฌํํ์ต๋๋ค. (URI: `/v1/projects`) - GET `/{name}`: ํ๋ก์ ํธ ์กฐํ - POST `/`: ํ๋ก์ ํธ ์์ฑ - PUT `/{id}`: ํ๋ก์ ํธ ์์ - DELETE `/{id}`: ํ๋ก์ ํธ ์ ๊ฑฐ * test: Project Controller ํ ์คํธ - `@WebMvcTest` ๊ธฐ๋ฐ ProjectController ํ ์คํธ๋ฅผ ์งํํ์ต๋๋ค. * chore: ControllerTestSupport ์์ - ProjectService MockBean ์ด๋
๐ ๊ฐ๋ฐ ์ฌํญ
์ด์ ๋ฒํธ
ํน์ด ์ฌํญ ๐ซถ
ApiCommonResponse
ํ์์ ๋ฐ๋ฆ ๋๋ค.API ๋ฌธ์ํ
1. ํ๋ก์ ํธ ์กฐํ
2. ํ๋ก์ ํธ ์์ฑ
3. ํ๋ก์ ํธ ์์
4. ํ๋ก์ ํธ ์ญ์