Skip to content

Commit 4a0f70a

Browse files
[EA3-78] feat : 스터디 게시판 컨트롤러 생성
1 parent 23eb28a commit 4a0f70a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package grep.neogul_coder.domain.studypost.controller;
2+
3+
import grep.neogul_coder.domain.studypost.dto.StudyPostDetailResponse;
4+
import grep.neogul_coder.domain.studypost.dto.StudyPostListResponse;
5+
import grep.neogul_coder.domain.studypost.dto.StudyPostRequest;
6+
import grep.neogul_coder.global.response.ApiResponse;
7+
import jakarta.validation.Valid;
8+
import java.util.List;
9+
import org.springframework.web.bind.annotation.*;
10+
11+
@RestController
12+
@RequestMapping("/api/studies/{studyId}/posts")
13+
public class StudyPostController implements StudyPostSpecification {
14+
15+
@PostMapping
16+
public ApiResponse<Void> create(
17+
@PathVariable("studyId") Long studyId,
18+
@RequestBody @Valid StudyPostRequest request
19+
) {
20+
return ApiResponse.noContent();
21+
}
22+
23+
@GetMapping("/all")
24+
public ApiResponse<List<StudyPostListResponse>> findAllWithoutPagination(
25+
@PathVariable("studyId") Long studyId
26+
) {
27+
List<StudyPostListResponse> content = List.of(new StudyPostListResponse());
28+
return ApiResponse.success(content);
29+
}
30+
31+
@GetMapping("/{postId}")
32+
public ApiResponse<StudyPostDetailResponse> findOne(
33+
@PathVariable("studyId") Long studyId,
34+
@PathVariable("postId") Long postId
35+
) {
36+
return ApiResponse.success(new StudyPostDetailResponse());
37+
}
38+
39+
@PutMapping("/{postId}")
40+
public ApiResponse<Void> update(
41+
@PathVariable("studyId") Long studyId,
42+
@PathVariable("postId") Long postId,
43+
@RequestBody @Valid StudyPostRequest request
44+
) {
45+
return ApiResponse.noContent();
46+
}
47+
48+
@DeleteMapping("/{postId}")
49+
public ApiResponse<Void> delete(
50+
@PathVariable("studyId") Long studyId,
51+
@PathVariable("postId") Long postId
52+
) {
53+
return ApiResponse.noContent();
54+
}
55+
}

0 commit comments

Comments
 (0)