package Ġcom . in nop ol is . in no queue . controller Ċ Ċ import Ġcom . in nop ol is . in no queue . controller . dto . Task DTO Ċ import Ġcom . in nop ol is . in no queue . dto . ToDo Task DTO Ċ import Ġcom . in nop ol is . in no queue . service . ToDo Task Service Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . web . bind . annotation .* Ċ Ċ @ RestController Ċ @ RequestMapping ("/ tasks ") Ċ class ĠTo Do Tasks Controller ( private Ġval Ġservice : ĠTo Do Task Service ) Ġ{ ĊĊĠĠĠ Ġ@ ExceptionHandler ( NoSuch ElementException :: class ) ĊĠĠĠ Ġfun Ġhandle NotFound ( e : ĠNoSuch ElementException ): ĠResponseEntity < String > Ġ= ĊĠĠĠĠĠĠĠ ĠResponseEntity ( e . message , ĠHttpStatus . NOT _ FOUND ) ĊĊĠĠĠ Ġ@ ExceptionHandler ( IllegalArgumentException :: class ) ĊĠĠĠ Ġfun Ġhandle BadRequest ( e : ĠIllegalArgumentException ): ĠResponseEntity < String > Ġ= ĊĠĠĠĠĠĠĠ ĠResponseEntity ( e . message , ĠHttpStatus . BAD _ REQUEST ) ĊĊĠĠĠ Ġ@ GetMapping ĊĠĠĠ Ġfun Ġget Tasks (@ Request Header (" user - token ") Ġtoken : ĠString ): ĠList < ToDo Task DTO > Ġ= Ġservice . get Tasks ( token ) ĊĊĠĠĠ Ġ@ PostMapping ("/ done ") ĊĠĠĠ Ġ@ ResponseStatus ( HttpStatus . OK ) ĊĠĠĠ Ġfun Ġcomplete Task (@ Request Header (" user - token ") Ġtoken : ĠString , Ġ@ RequestBody Ġtask : ĠTask DTO ) Ġ= ĊĠĠĠĠĠĠĠ Ġservice . complete Task ( token , Ġtask . taskId , Ġtask . exp enses ) ĊĊĠĠĠ Ġ@ PostMapping ("/ skip ") ĊĠĠĠ Ġ@ ResponseStatus ( HttpStatus . OK ) ĊĠĠĠ Ġfun Ġskip Task (@ Request Header (" user - token ") Ġtoken : ĠString , Ġ@ RequestBody Ġtask : ĠTask DTO ): ĠUnit Ġ= ĊĠĠĠĠĠĠĠ Ġservice . skip Task ( token , Ġtask . taskId ) Ċ } Ċ