package Ġcom . cock t ails guru . app . user . controller Ċ Ċ import Ġcom . cock t ails guru . app . user . controller . User Favorite Controller . Companion . USER _ FA V OR ITE _ BASE _ PATH Ċ import Ġcom . cock t ails guru . app . user . dto . favorite . Set Favorite Request Dto Ċ import Ġcom . cock t ails guru . app . user . dto . favorite . Set Favorite Response Dto Ċ import Ġcom . cock t ails guru . app . user . service . User Favorite Service Ċ import Ġcom . cock t ails guru . app . utils . logger For Ċ import Ġcom . cock t ails guru . app . verification . service . User Verification Service Ċ import Ġorg . springframework . security . access . annotation . Sec ured Ċ import Ġorg . springframework . web . bind . annotation . RequestBody Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . Request Method Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ Ċ @ RestController Ċ @ Sec ured ( value Ġ= Ġ[" ROLE _ MOB ILE "]) Ċ @ RequestMapping ( USER _ FA V OR ITE _ BASE _ PATH ) Ċ class ĠUser Favorite Controller ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġuser Favorite Service : ĠUser Favorite Service , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġuser Verification Service : ĠUser Verification Service Ċ ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlogger Ġ= Ġlogger For ( java Class ) ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠUSER _ FA V OR ITE _ BASE _ PATH Ġ= Ġ" favorite " ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠF AV OR ITE _ CO CK TAIL Ġ= Ġ" cock tail " ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠF AV OR ITE _ PI CTURE Ġ= Ġ" picture " ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ RequestMapping ( value Ġ= Ġ[ FA V OR ITE _ CO CK TAIL ], Ġproduces Ġ= Ġ[" application / json "], Ġmethod Ġ= Ġ[ Request Method . POST ]) ĊĠĠĠ Ġfun Ġset C ock tail Favorite (@ RequestBody Ġrequest Dto : ĠSet Favorite Request Dto ): ĠSet Favorite Response Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġlogger . info (" Requested Ġc ock tail Ġset Ġas Ġfavorite Ġ- Ġ{}", Ġrequest Dto ) ĊĊĠĠĠĠĠĠĠ Ġval Ġlogged User Ġ= Ġuser Verification Service . get Logged User () ĊĊĠĠĠĠĠĠĠ Ġval Ġset Favorite Result Type Ġ= Ġuser Favorite Service . set C ock tail As Favorite ( request Dto . objectId , Ġlogged User ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠSet Favorite Response Dto ( set Favorite Result Type ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ RequestMapping ( value Ġ= Ġ[ FA V OR ITE _ PI CTURE ], Ġproduces Ġ= Ġ[" application / json "], Ġmethod Ġ= Ġ[ Request Method . POST ]) ĊĠĠĠ Ġfun Ġset Picture Favorite (@ RequestBody Ġrequest Dto : ĠSet Favorite Request Dto ): ĠSet Favorite Response Dto Ġ{ ĊĠĠĠĠĠĠĠ Ġlogger . info (" Requested Ġpicture Ġset Ġas Ġfavorite Ġ- Ġ{}", Ġrequest Dto ) ĊĊĠĠĠĠĠĠĠ Ġval Ġlogged User Ġ= Ġuser Verification Service . get Logged User () ĊĊĠĠĠĠĠĠĠ Ġval Ġset Favorite Result Type Ġ= Ġuser Favorite Service . set Picture As Favorite ( request Dto . objectId , Ġlogged User ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠSet Favorite Response Dto ( set Favorite Result Type ) ĊĠĠĠ Ġ} Ċ }