-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBoardController.java
More file actions
44 lines (31 loc) · 1.23 KB
/
BoardController.java
File metadata and controls
44 lines (31 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.makefire.anonymous.rest.controller.api;
import com.makefire.anonymous.rest.RestSupport;
import com.makefire.anonymous.rest.dto.request.board.BoardRequest;
import com.makefire.anonymous.rest.dto.response.Response;
import com.makefire.anonymous.service.board.BoardService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequiredArgsConstructor
@RequestMapping("/board")
@Slf4j
public class BoardController extends RestSupport {
private final BoardService boardService;
@PostMapping
public ResponseEntity<Response> createBoard(
@Valid @RequestBody BoardRequest boardRequest) {
log.info("createBoard", boardRequest.toString());
return response(boardService.createBoard(boardRequest));
}
@GetMapping("{id}")
public ResponseEntity<Response> selectBoard(@PathVariable("id") Long id) {
return response(boardService.selectBoard(id));
}
@DeleteMapping("{id}")
public ResponseEntity<Response> deleteBoard(@PathVariable("id") Long id) {
return response(boardService.deleteBoard(id));
}
}