diff --git a/core/src/main/java/cz/muni/fi/pa165/core/device/DeviceController.java b/core/src/main/java/cz/muni/fi/pa165/core/device/DeviceController.java index dc4cfc8280b2a4df35374206bef456595c4cc1f1..933e9fe281ceceac63bc926e78c81c2889ced29b 100644 --- a/core/src/main/java/cz/muni/fi/pa165/core/device/DeviceController.java +++ b/core/src/main/java/cz/muni/fi/pa165/core/device/DeviceController.java @@ -14,64 +14,54 @@ import java.util.List; @RequestMapping("/api/device") public class DeviceController { - private final DeviceService deviceService; + private final DeviceService deviceService; - private final DeviceMapper mapper; + private final DeviceMapper mapper; - @Autowired - public DeviceController(DeviceService deviceService, DeviceMapper mapper) { - this.deviceService = deviceService; - this.mapper = mapper; - } + @Autowired + public DeviceController(DeviceService deviceService, DeviceMapper mapper) { + this.deviceService = deviceService; + this.mapper = mapper; + } - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get all devices pageable", - description = """ - ......... - """) - @GetMapping("pageable") - public List<DeviceDto> findAllPageable(Pageable pageable){ - return mapper.toDtoList((List<Device>) deviceService.findAllPageable(pageable)); - } + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get all devices pageable", + description = "...") + @GetMapping("pageable") + public List<DeviceDto> findAllPageable(Pageable pageable) { + return mapper.toDtoList((List<Device>) deviceService.findAllPageable(pageable)); + } - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get all devices", - description = """ - ......... - """) - @CrossOrigin(origins = "*") - @GetMapping// CORS headers needed for JavaScript clients - public List<DeviceDto> findAll(){ - return mapper.toDtoList(deviceService.findAll()); - } + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get all devices", + description = "...") + @CrossOrigin(origins = "*") + @GetMapping // CORS headers needed for JavaScript clients + public List<DeviceDto> findAll() { + return mapper.toDtoList(deviceService.findAll()); + } - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get device by id", - description = """ - ......... - """) - @GetMapping("/{id}") - public DeviceDto find(@PathVariable String id) { - return mapper.toDto(deviceService.findById(id)); - } + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get device by id", + description = "...") + @GetMapping("/{id}") + public DeviceDto find(@PathVariable String id) { + return mapper.toDto(deviceService.findById(id)); + } - @Operation( // metadata for inclusion into OpenAPI document - summary = "Create device", - description = """ - ......... - """) - @PostMapping - public DeviceDto create(@RequestBody DeviceCreateDto deviceDto) { - return mapper.toDto(deviceService.create(mapper.fromCreateDto(deviceDto))); - } + @Operation( // metadata for inclusion into OpenAPI document + summary = "Create device", + description = "...") + @PostMapping + public DeviceDto create(@RequestBody DeviceCreateDto deviceDto) { + return mapper.toDto(deviceService.create(mapper.fromCreateDto(deviceDto))); + } - @Operation( // metadata for inclusion into OpenAPI document - summary = "Update device", - description = """ - ......... - """) - @PutMapping - public DeviceDto update(@RequestBody DeviceUpdateDto deviceDto) { - return mapper.toDto(deviceService.create(mapper.fromUpdateDto(deviceDto))); - } + @Operation( // metadata for inclusion into OpenAPI document + summary = "Update device", + description = "...") + @PutMapping + public DeviceDto update(@RequestBody DeviceUpdateDto deviceDto) { + return mapper.toDto(deviceService.create(mapper.fromUpdateDto(deviceDto))); + } } diff --git a/core/src/main/java/cz/muni/fi/pa165/core/smartmeter/SmartMeterController.java b/core/src/main/java/cz/muni/fi/pa165/core/smartmeter/SmartMeterController.java index d8a077efd58aa777b319b22bef14e8db1a113fa7..ce6f5a345d146c074897b6c0799ea6500de574b4 100644 --- a/core/src/main/java/cz/muni/fi/pa165/core/smartmeter/SmartMeterController.java +++ b/core/src/main/java/cz/muni/fi/pa165/core/smartmeter/SmartMeterController.java @@ -12,54 +12,45 @@ import java.util.List; @RestController @RequestMapping("/api/smart-meter") public class SmartMeterController { - private final SmartMeterService smartMeterService; - private final SmartMeterMapper mapper; - - @Autowired - public SmartMeterController(SmartMeterService smartMeterService, SmartMeterMapper mapper) { - this.smartMeterService = smartMeterService; - this.mapper = mapper; - } - - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get all smartMeter pageable", - description = """ - ......... - """) - @GetMapping("pageable") - public List<SmartMeterDto> findAllPageable(Pageable pageable){ - return mapper.toDtoList((List<SmartMeter>) smartMeterService.findAllPageable(pageable)); - } - - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get all smartMeters", - description = """ - ......... - """) - @CrossOrigin(origins = "*") - @GetMapping// CORS headers needed for JavaScript clients - public List<SmartMeterDto> findAll(){ - return mapper.toDtoList(smartMeterService.findAll()); - } - - @Operation( // metadata for inclusion into OpenAPI document - summary = "Get smartMeter by id", - description = """ - ......... - """) - @GetMapping("/{id}") - public SmartMeterDto find(@PathVariable String id) { - return mapper.toDto(smartMeterService.findById(id)); - } - - @Operation( // metadata for inclusion into OpenAPI document - summary = "Create smartMeter", - description = """ - ......... - """) - @PostMapping - public SmartMeterDto create(@RequestBody SmartMeterCreateDto smartMeterDto) { - return mapper.toDto(smartMeterService.create(mapper.fromCreateDto(smartMeterDto))); - } - + private final SmartMeterService smartMeterService; + private final SmartMeterMapper mapper; + + @Autowired + public SmartMeterController(SmartMeterService smartMeterService, SmartMeterMapper mapper) { + this.smartMeterService = smartMeterService; + this.mapper = mapper; + } + + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get all smartMeter pageable", + description = "...") + @GetMapping("pageable") + public List<SmartMeterDto> findAllPageable(Pageable pageable) { + return mapper.toDtoList((List<SmartMeter>) smartMeterService.findAllPageable(pageable)); + } + + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get all smartMeters", + description = "...") + @CrossOrigin(origins = "*") + @GetMapping // CORS headers needed for JavaScript clients + public List<SmartMeterDto> findAll() { + return mapper.toDtoList(smartMeterService.findAll()); + } + + @Operation( // metadata for inclusion into OpenAPI document + summary = "Get smartMeter by id", + description = "...") + @GetMapping("/{id}") + public SmartMeterDto find(@PathVariable String id) { + return mapper.toDto(smartMeterService.findById(id)); + } + + @Operation( // metadata for inclusion into OpenAPI document + summary = "Create smartMeter", + description = "...") + @PostMapping + public SmartMeterDto create(@RequestBody SmartMeterCreateDto smartMeterDto) { + return mapper.toDto(smartMeterService.create(mapper.fromCreateDto(smartMeterDto))); + } }