package Ġcom . ep am . br n . controller Ċ Ċ import Ġcom . ep am . br n . dto . Base Response Dto Ċ import Ġcom . ep am . br n . dto . request . Add Patient To Doctor Request Ċ import Ġcom . ep am . br n . service . Doctor Service Ċ import Ġio . swagger . annotations . Api Ċ import Ġio . swagger . annotations . ApiOperation Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . validation . annotation . Validated Ċ 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 . RequestBody Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . ResponseStatus Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ Ċ @ RestController Ċ @ RequestMapping ("/ do ctors ") Ċ @ Api ( value Ġ= Ġ"/ do ctors ", Ġdescription Ġ= Ġ" Contains Ġactions Ġfor Ġdoctor ") Ċ class ĠDoctor Controller ( private Ġval Ġdoctor Service : ĠDoctor Service ) Ġ{ ĊĊĠĠĠ Ġ@ PostMapping ("/ { doctor Id }/ pat ients ") ĊĠĠĠ Ġ@ ResponseStatus ( HttpStatus . OK ) ĊĠĠĠ Ġ@ ApiOperation (" Add Ġpatient Ġto Ġdoctor ") ĊĠĠĠ Ġfun Ġadd Patient To Doctor ( ĊĠĠĠĠĠĠĠ Ġ@ PathVariable Ġdoctor Id : ĠLong , ĊĠĠĠĠĠĠĠ Ġ@ Validated Ġ@ RequestBody Ġadd Patient To Doctor Request : ĠAdd Patient To Doctor Request ĊĠĠĠ Ġ) Ġ= Ġdoctor Service . add Patient To Doctor As Doctor ( doctor Id , Ġadd Patient To Doctor Request . id ) ĊĊĠĠĠ Ġ@ GetMapping ("/ { doctor Id }/ pat ients ") ĊĠĠĠ Ġ@ ApiOperation (" Get Ġall Ġpatients Ġfor Ġdoctor ") ĊĠĠĠ Ġfun ĠgetAll Patient For Doctor (@ PathVariable Ġdoctor Id : ĠLong ): ĠResponseEntity < Base Response Dto > Ġ= ĊĠĠĠĠĠĠĠ ĠResponseEntity . ok ( Base Response Dto ( data Ġ= Ġdoctor Service . get Pat ients For Doctor ( doctor Id ))) ĊĊĠĠĠ Ġ@ Delete Mapping ("/ { doctor Id }/ pat ients /{ patient Id }") ĊĠĠĠ Ġ@ ResponseStatus ( HttpStatus . OK ) ĊĠĠĠ Ġ@ ApiOperation (" Delete Ġpatient Ġfrom Ġdoctor ") ĊĠĠĠ Ġfun Ġdelete Patient From Doctor (@ PathVariable Ġdoctor Id : ĠLong , Ġ@ PathVariable Ġpatient Id : ĠLong ) Ġ= ĊĠĠĠĠĠĠĠ Ġdoctor Service . delete Doctor From Patient As Doctor ( doctor Id , Ġpatient Id ) Ċ } Ċ