package Ġkotlin App . controllers Ċ Ċ import Ġkotlin App . model . Message Ċ import Ġkotlin App . model . Topic Ċ import Ġkotlin App . repositories . Topic Repository Ċ import Ġorg . springframework . web . bind . annotation . Delete Mapping Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . PathVariable Ċ import Ġorg . springframework . web . bind . annotation . PostMapping Ċ import Ġorg . springframework . web . bind . annotation . Put Mapping Ċ import Ġorg . springframework . web . bind . annotation . RequestBody Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestParam Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġjava . util . UUID Ċ Ċ @ RestController Ċ @ RequestMapping ("/ topic ") Ċ open Ġclass ĠTopic Controller ( val Ġtopic Repository : ĠTopic Repository ) Ġ{ ĊĊ ĉ @ GetMapping Ċ ĉ open Ġfun Ġget Topics (): ĠList < Topic > Ġ= Ġtopic Repository . findAll () ĊĊ ĉ @ GetMapping ("/ { id }") Ċ ĉ open Ġfun Ġget Topics (@ PathVariable (" id ") Ġid : ĠString ): ĠList < Topic > Ġ= Ġtopic Repository . findAll (). filter Ġ{ Ġit . id Ġ== Ġid Ġ} ĊĊ ĉ @ PostMapping Ċ ĉ open Ġfun Ġcreate Topic (@ RequestBody Ġquestion : ĠQuestion ) Ġ= Ġtopic Repository . save ( Topic ( question Ġ= Ġquestion . content )) ĊĊ ĉ @ Put Mapping Ċ ĉ open Ġfun Ġupdate Topic (@ RequestBody Ġtopic : ĠTopic ) Ġ= Ġtopic Repository . save ( topic ) ĊĊ ĉ @ Delete Mapping Ċ ĉ open Ġfun Ġdelete Topic (@ RequestParam Ġid : ĠString ) Ġ= Ġtopic Repository . delete ( id ) ĊĉĊ ĉ data Ġclass ĠQuestion ( val Ġcontent : ĠString Ġ= Ġ"") Ċ } Ċ