-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduleController.java
More file actions
30 lines (25 loc) · 1.03 KB
/
ScheduleController.java
File metadata and controls
30 lines (25 loc) · 1.03 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
package com.app.controller;
import com.app.dto.Schedule;
import com.app.service.ScheduleService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequiredArgsConstructor
@RequestMapping("schedule")
public class ScheduleController {
private final ScheduleService ScheduleService;
@PostMapping("add")
public ResponseEntity<Schedule> addSchedule(@RequestBody Schedule schedule) {
return new ResponseEntity<>(ScheduleService.addSchedule(schedule), HttpStatus.OK);
}
@PutMapping("update")
public ResponseEntity<Schedule> updateSchedule(@RequestBody Schedule schedule) {
return new ResponseEntity<>(ScheduleService.updateSchedule(schedule), HttpStatus.OK);
}
@DeleteMapping("delete")
public ResponseEntity<Schedule> deleteSchedule(@RequestParam Long id) {
return new ResponseEntity<>(ScheduleService.deleteSchedule(id), HttpStatus.OK);
}
}