package Ġno . edge works . kotlin beer . user Ċ Ċ import Ġno . edge works . kotlin beer . legacy . Legacy Repository Ċ import Ġno . edge works . kotlin beer . legacy . Legacy User DAO Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . web . bind . annotation .* Ċ Ċ @ RestController Ċ @ RequestMapping ( pro duces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) Ċ class ĠUser Controller ( ĊĠĠĠ Ġ@ Autowired Ġval ĠuserService : ĠUserService , ĊĠĠĠ Ġ@ Autowired Ġval Ġlegacy Repository : ĠLegacy Repository , Ċ ) Ġ{ ĊĠĠĠ Ġ@ GetMapping ("/ legacy ") ĊĠĠĠ Ġfun Ġget Legacy (): ĠList < Legacy User DAO > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġlegacy Repository . get Users () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ("/ new ") ĊĠĠĠ Ġfun Ġget New (): ĠList < User DTO > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠuserService . getAll Users (). map Ġ{ ĠUser DTO ( it ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ GetMapping ("/ users /{ card Id }") ĊĠĠĠ Ġfun ĠgetUser By Card Id (@ PathVariable Ġcard Id : ĠLong ): ĠUser DTO Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠUser DTO ( userService . getUser By Card Id ( card Id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ PostMapping ("/ users ") ĊĠĠĠ Ġfun Ġcreate User (@ RequestBody Ġnew User : ĠUser DTO ): ĠUser DTO Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠUser DTO ( userService . createUser ( User ( new User ), Ġ" new ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Patch Mapping ("/ users ") ĊĠĠĠ Ġfun Ġupdate UserDetails (@ RequestBody Ġupdated User : ĠUser DTO ): ĠUser DTO Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠUser DTO ( userService . update UserDetails ( User ( updated User ), Ġ" changed By ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Patch Mapping ("/ users / update Card Id ") ĊĠĠĠ Ġfun Ġchange User Card Id (@ RequestParam Ġemail : ĠString , Ġ@ RequestParam Ġnew Card Id : ĠLong ): ĠUser DTO Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠUser DTO ( userService . change User Card Id ( email , Ġnew Card Id , Ġ" changed By ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Delete Mapping ("/ users /{ card Id }") ĊĠĠĠ Ġfun Ġdelete User (@ PathVariable Ġcard Id : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ ĠuserService . delete User ( card Id ) ĊĠĠĠ Ġ} Ċ Ċ }