Skip to content

Commit 9ab28f4

Browse files
committed
feat(TimeController): [8단계] 시간 삭제 API 생성
1 parent 156607a commit 9ab28f4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/roomescape/controller/TimeController.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
import org.springframework.jdbc.support.GeneratedKeyHolder;
88
import org.springframework.jdbc.support.KeyHolder;
99
import org.springframework.stereotype.Controller;
10-
import org.springframework.web.bind.annotation.GetMapping;
11-
import org.springframework.web.bind.annotation.PostMapping;
12-
import org.springframework.web.bind.annotation.RequestBody;
13-
import org.springframework.web.bind.annotation.ResponseBody;
10+
import org.springframework.web.bind.annotation.*;
1411
import roomescape.model.time.Time;
1512
import roomescape.model.time.TimeRequest;
1613

@@ -26,6 +23,7 @@ public class TimeController {
2623
public TimeController(JdbcTemplate jdbcTemplate) {
2724
this.jdbcTemplate = jdbcTemplate;
2825
}
26+
2927
@GetMapping("/times")
3028
@ResponseBody
3129
public List<Time> getTimes() {
@@ -63,4 +61,10 @@ public ResponseEntity<Time> createTimes(@RequestBody TimeRequest timeRequest) {
6361
.header("Location", "/times/" + time.getId())
6462
.body(time);
6563
}
64+
65+
@DeleteMapping("/times/{id}")
66+
public ResponseEntity<Void> deleteTime(@PathVariable Long id) {
67+
String sql = "DELETE FROM time WHERE id = ?";
68+
return ResponseEntity.noContent().build();
69+
}
6670
}

0 commit comments

Comments
 (0)