-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #648 from woowacourse-teams/develop
Release v1.5.0
- Loading branch information
Showing
74 changed files
with
1,642 additions
and
465 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
= Question | ||
:toc: left | ||
:toclevels: 2 | ||
:sectlinks: | ||
:source-highlighter: highlightjs | ||
|
||
[[home]] | ||
== home | ||
|
||
* link:index.html[목록으로 가기] | ||
|
||
== 시트 질문 조회 | ||
|
||
=== 시트 질문 조회 성공 | ||
|
||
operation::find-questions[] | ||
|
||
== 시트 질문 수정 | ||
|
||
=== 시트 질문 수정 성공 | ||
|
||
operation::update-questions[] |
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
37 changes: 37 additions & 0 deletions
37
back/src/main/java/com/woowacourse/teatime/teatime/controller/QuestionController.java
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,37 @@ | ||
package com.woowacourse.teatime.teatime.controller; | ||
|
||
import com.woowacourse.teatime.auth.support.CoachAuthenticationPrincipal; | ||
import com.woowacourse.teatime.teatime.controller.dto.request.SheetQuestionUpdateRequest; | ||
import com.woowacourse.teatime.teatime.controller.dto.response.SheetQuestionsResponse; | ||
import com.woowacourse.teatime.teatime.service.QuestionService; | ||
import java.util.List; | ||
import javax.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/v2/questions") | ||
public class QuestionController { | ||
|
||
private final QuestionService questionService; | ||
|
||
@GetMapping | ||
public ResponseEntity<SheetQuestionsResponse> get(@CoachAuthenticationPrincipal Long coachId) { | ||
SheetQuestionsResponse response = questionService.get(coachId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@PutMapping | ||
public ResponseEntity<Void> update( | ||
@CoachAuthenticationPrincipal Long coachId, @Valid @RequestBody List<SheetQuestionUpdateRequest> request) { | ||
questionService.update(coachId, request); | ||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); | ||
} | ||
} |
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
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
26 changes: 26 additions & 0 deletions
26
...n/java/com/woowacourse/teatime/teatime/controller/dto/response/SheetQuestionResponse.java
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,26 @@ | ||
package com.woowacourse.teatime.teatime.controller.dto.response; | ||
|
||
import com.woowacourse.teatime.teatime.domain.Question; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class SheetQuestionResponse { | ||
|
||
private Integer questionNumber; | ||
|
||
private String questionContent; | ||
|
||
private Boolean isRequired; | ||
|
||
public static SheetQuestionResponse from(Question question) { | ||
return new SheetQuestionResponse( | ||
question.getNumber(), | ||
question.getContent(), | ||
question.getIsRequired()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
.../java/com/woowacourse/teatime/teatime/controller/dto/response/SheetQuestionsResponse.java
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,23 @@ | ||
package com.woowacourse.teatime.teatime.controller.dto.response; | ||
|
||
import com.woowacourse.teatime.teatime.domain.Question; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class SheetQuestionsResponse { | ||
|
||
private List<SheetQuestionResponse> questions; | ||
|
||
public static SheetQuestionsResponse from(List<Question> savedQuestions) { | ||
return new SheetQuestionsResponse(savedQuestions.stream() | ||
.map(SheetQuestionResponse::from) | ||
.collect(Collectors.toList())); | ||
} | ||
} |
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
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
Oops, something went wrong.