package Ġcom . q ing zh u . dispatcher . customer . controller Ċ Ċ import Ġcom . q ing zh u . common . util . await Get Organization Id Ċ import Ġcom . q ing zh u . dispatcher . customer . domain . entity . Comment Ċ import Ġcom . q ing zh u . dispatcher . customer . domain . query . Comment Query Ċ import Ġcom . q ing zh u . dispatcher . customer . service . Comment Service Ċ import Ġkotlinx . coroutines . reactive . await Single Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġorg . springframework . web . reactive . function . server .* Ċ Ċ @ RestController Ċ class ĠComment Handler ( private Ġval Ġcomment Service : ĠComment Service ) Ġ{ ĊĠĠĠ Ġsuspend Ġfun Ġfind Comment ( sr : ĠServer Request ): ĠServer Response Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( org Id ) Ġ= Ġsr . await Get Organization Id () ĊĠĠĠĠĠĠĠ Ġreturn Ġsr . body To Mono < Comment Query >() ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. do On Next Ġ{ Ġit . organization Id Ġ= Ġorg Id Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. flatMap Ġ{ ĠServer Response . ok (). body ( comment Service . find Comment ( it )) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. await Single () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġsave Comment ( sr : ĠServer Request ): ĠServer Response Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġsr . body To Flux < Comment >() ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. transform Ġ{ ĠServer Response . ok (). body ( comment Service . save Comment ( it )) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. await Single () ĊĠĠĠ Ġ} Ċ }