package Ġhello . controller Ċ Ċ import Ġhello . Application Ċ import Ġhello . repositories . Skin Data Repository Ċ import Ġhello . data . Profile Skin Response Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . cache . annotation . Cache Ev ict Ċ import Ġorg . springframework . cache . annotation . Cache Put Ċ import Ġorg . springframework . cache . annotation . Cache able Ċ import Ġorg . springframework . web . bind . annotation .* ĊĊ Ċ /** Ċ Ġ* ĠCreated Ġby Ġy sl 3 0 0 0 Ċ Ġ*/ Ċ Ċ @ RestController Ċ @ RequestMapping (" session / minecraft / profile ") Ċ class ĠSk inData Controller Ġ{ ĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġskin Data Repository : ĠSk inData Repository ĊĠĠĠ Ġprivate Ġval Ġlog Ġ= ĠLoggerFactory . getLogger ( Application :: class . java ) ĊĊĊĠĠĠ Ġ@ Cache Ev ict ( value Ġ= Ġ[" skin - list "]) ĊĠĠĠ Ġ@ GetMapping ("/ delete ") ĊĠĠĠ Ġfun Ġdelete All () = Ġskin Data Repository . delete All () ĊĊĊĠĠĠ Ġ@ Cache able ( value Ġ= Ġ[" skin - single "], key Ġ= Ġ"# player UUID ", Ġunless Ġ= Ġ"# result == null ") ĊĠĠĠ Ġ@ GetMapping ("/ { player UUID }") ĊĠĠĠ Ġfun ĠfindBy Player UUID (@ PathVariable Ġplayer UUID : ĠString ): ĠProfile Skin Response Ġ= Ġskin Data Repository . find Skin By Player UUID ( player UUID ) ?: Ġthrow ĠException (" No Ġdata Ġwith Ġthis Ġentity Ġavailable ") ĊĊĠĠĠ Ġ@ Cache able ( value Ġ= Ġ[" skin - list "], key Ġ= Ġ"# name ") ĊĠĠĠ Ġ@ GetMapping ("/ name /{ name }") ĊĠĠĠ Ġfun ĠfindBy Player Name (@ PathVariable Ġname : ĠString ): ĠList < Profile Skin Response > Ġ= Ġskin Data Repository . find Skin ByName ( name ) ĊĊĊĠĠĠ Ġ@ GetMapping ("/") ĊĠĠĠ Ġfun ĠfindAll (): ĠIterable < Profile Skin Response > Ġ= Ġskin Data Repository . findAll () ĊĊĠĠĠ Ġ@ Cache Put ( value = Ġ[" skin - single "], key Ġ= Ġ"# profile Skin Response . player UUID ") ĊĠĠĠ Ġ@ PostMapping ("/") ĊĠĠĠ Ġfun Ġadd Skin Data (@ RequestBody Ġprofile Skin Response : ĠProfile Skin Response ): ĠProfile Skin Response ? Ġ{ ĊĊĊĠĠĠĠĠĠĠ Ġval Ġexist Ġ= Ġskin Data Repository . find Skin By Player UUID ( player UUID Ġ= Ġprofile Skin Response . player UUID ) ĊĊĠĠĠĠĠĠĠ Ġlog . info (" User Ġalready Ġexists : Ġ$ exist ") ĊĊĠĠĠĠĠĠĠ Ġif Ġ( exist Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠException (" Skin ĠProfile Ġis Ġalready Ġin Ġdb ") ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġreturn Ġskin Data Repository . save ( profile Skin Response ) ĊĠĠĠ Ġ} Ċ Ċ }