package ec.edu.espe.movilidad.MovilidadWS.Controller; import ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTPlanificacion; import ec.edu.espe.movilidad.MovilidadWS.Service.UzyTPlanificacion.IServiceUzyTPlanificacion; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; import static ec.edu.espe.movilidad.MovilidadWS.Constant.GlobalConstants.V1_API_VERSION; @RestController @CrossOrigin(origins = "*") @RequestMapping(V1_API_VERSION+"/planificacion") public class UzyTPlanificacionController { @Autowired IServiceUzyTPlanificacion serviceUzyTPlanificacion; @GetMapping("/exampleFindId/{id}") public ResponseEntity<ModelUzyTPlanificacion> ListarPorID(@PathVariable Long id) { return new ResponseEntity<>(serviceUzyTPlanificacion.ListarPorID(id), HttpStatus.OK); } @GetMapping("/getAll") public ResponseEntity<List<ModelUzyTPlanificacion>> ListarRegistros() { return new ResponseEntity<>(serviceUzyTPlanificacion.ListarRegistros(), HttpStatus.OK); } @PostMapping("/guardar") public ResponseEntity<ModelUzyTPlanificacion> guardar(@RequestBody ModelUzyTPlanificacion modelUzyTPlanificacion) { return new ResponseEntity<>(serviceUzyTPlanificacion.guardar(modelUzyTPlanificacion), HttpStatus.OK); } @PutMapping("/editar/{id}") public ResponseEntity<ModelUzyTPlanificacion> editar(@PathVariable Long id, @RequestBody ModelUzyTPlanificacion modelUzyTPlanificacion) { return new ResponseEntity<>(serviceUzyTPlanificacion.editar(id, modelUzyTPlanificacion), HttpStatus.OK); } @DeleteMapping("/eliminar/{id}") public ResponseEntity<Void> eliminar(@PathVariable Long id) { serviceUzyTPlanificacion.eliminar(id); return ResponseEntity.ok().build(); } }