package Ġcom . example . spring boot template . controller Ċ Ċ import Ġcom . example . spring boot template . dto . request . Folder Add Request Ċ import Ġcom . example . spring boot template . dto . request . Folder Item Add Request Ċ import Ġcom . example . spring boot template . dto . response . Folder Response Ċ import Ġcom . example . spring boot template . service . Folder Item Service Ċ import Ġcom . example . spring boot template . service . Folder Service Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . PostMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestBody Ċ import Ġorg . springframework . web . bind . annotation . ResponseStatus Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ Ċ const Ġval ĠGetAll Folders Ġ= Ġ"/ folders " Ċ const Ġval ĠAdd Folder Ġ= Ġ"/ folders " Ċ const Ġval ĠAdd Folder Item Ġ= Ġ"/ folders / items " Ċ Ċ @ RestController Ċ class ĠFolder Controller ( ĊĠĠĠ Ġprivate Ġval Ġfolder Service : ĠFolder Service , ĊĠĠĠ Ġprivate Ġval Ġfolder Item Service : ĠFolder Item Service Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ ResponseStatus ( code Ġ= ĠHttpStatus . OK ) ĊĠĠĠ Ġ@ GetMapping ( GetAll Folders , Ġproduces Ġ= Ġ[" application / json "]) ĊĠĠĠ Ġfun ĠgetAll Folders (): ĠList < Folder Response > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġfolder Service . getAll () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ ResponseStatus ( code Ġ= ĠHttpStatus . CREATED ) ĊĠĠĠ Ġ@ PostMapping ( Add Folder , Ġconsume s Ġ= Ġ[" application / json "], Ġproduces Ġ= Ġ[" application / json "]) ĊĠĠĠ Ġfun Ġadd New Folder (@ RequestBody Ġrequest : ĠFolder Add Request ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfolder Service . add New ( request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ ResponseStatus ( code Ġ= ĠHttpStatus . CREATED ) ĊĠĠĠ Ġ@ PostMapping ( Add Folder Item , Ġconsume s Ġ= Ġ[" application / json "], Ġproduces Ġ= Ġ[" application / json "]) ĊĠĠĠ Ġfun Ġadd New Folder Item (@ RequestBody Ġrequest : ĠFolder Item Add Request ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfolder Item Service . add New ( request ) ĊĠĠĠ Ġ} Ċ }