package Ġdigital . cap sa . ar che types . query . controller Ċ Ċ import Ġdigital . cap sa . ar che types . core . aggreg ates . Book Id Ċ import Ġdigital . cap sa . ar che types . core . aggreg ates . Library Id Ċ import Ġdigital . cap sa . ar che types . core . aggreg ates . Member Id Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Book Details DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Book Info DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Book Search Criteria DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Book SearchResult DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Member Details DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Member Info DTO Ċ import Ġdigital . cap sa . ar che types . query . controller . dto . Member Search Criteria DTO Ċ import Ġdigital . cap sa . ar che types . query . model . book . Book Ċ import Ġdigital . cap sa . ar che types . query . model . member . Member Ċ import Ġdigital . cap sa . ar che types . query . services . Book Service Ċ import Ġdigital . cap sa . ar che types . query . services . Member Service Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . util . UUID Ċ import Ġjava . util . function . Function Ċ Ċ @ Service Ċ class ĠQuery Controller Ġ{ ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġget Book List ( book Service : ĠBook Service ): ĠFunction < Book Search Criteria DTO , ĠBook SearchResult DTO > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFunction Ġ{ Ġcriteria Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ Function Ġbook Service . get Book List ( Library Id ( criteria . library Id )). transform () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġget Book Details ( book Service : ĠBook Service , Ġmember Service : ĠMember Service ): ĠFunction < UUID , ĠBook Details DTO ?> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFunction Ġ{ Ġbook Id Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbook Ġ= Ġbook Service . get Book ( Book Id ( book Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmember Ġ= Ġbook . member Id ?. let Ġ{ Ġmember Service . get Member ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ Function Ġbook . book Details ( member ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠBook . book Info (): ĠBook Info DTO Ġ= ĠBook Info DTO ( ĊĠĠĠĠĠĠĠ Ġbook Id Ġ= Ġid . book Id , ĊĠĠĠĠĠĠĠ Ġbook Status Ġ= Ġbook Status , ĊĠĠĠĠĠĠĠ Ġauthor Name Ġ= Ġauthor Name , ĊĠĠĠĠĠĠĠ Ġbook Title Ġ= Ġbook Title , ĊĠĠĠĠĠĠĠ Ġmember Id Ġ= Ġmember Id ?. member Id ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun ĠBook . book Details ( member : ĠMember ?): ĠBook Details DTO Ġ= ĠBook Details DTO ( ĊĠĠĠĠĠĠĠ Ġbook Info Ġ= Ġthis . book Info (), ĊĠĠĠĠĠĠĠ Ġmember FirstName Ġ= Ġmember ?. firstName , ĊĠĠĠĠĠĠĠ Ġmember LastName Ġ= Ġmember ?. lastName , ĊĠĠĠĠĠĠĠ Ġmember Email Ġ= Ġmember ?. email ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun ĠList < Book >. transform (): ĠBook SearchResult DTO Ġ= ĠBook SearchResult DTO ( book List Ġ= Ġmap Ġ{ Ġbook Ġ-> Ġbook . book Info () Ġ}) ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġget Member List ( member Service : ĠMember Service ): ĠFunction < Member Search Criteria DTO , ĠList < Member Info DTO >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFunction Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ Function Ġmember Service . get Member List (). map Ġ{ Ġit . member Info () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġget Member Details ( member Service : ĠMember Service ): ĠFunction < UUID , ĠMember Details DTO ?> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFunction Ġ{ Ġmember Id Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmember Ġ= Ġmember Service . get Member ( Member Id ( member Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn @ Function Ġmember . member Details ( member ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠMember . member Details ( member : ĠMember ?): ĠMember Details DTO Ġ= ĠMember Details DTO ( ĊĠĠĠĠĠĠĠ Ġmember Info Ġ= Ġthis . member Info () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun ĠMember . member Info (): ĠMember Info DTO Ġ= ĠMember Info DTO ( ĊĠĠĠĠĠĠĠ Ġmember Id Ġ= Ġid . member Id , ĊĠĠĠĠĠĠĠ ĠfirstName Ġ= ĠfirstName , ĊĠĠĠĠĠĠĠ ĠlastName Ġ= ĠlastName , ĊĠĠĠĠĠĠĠ Ġemail Ġ= Ġemail , ĊĠĠĠĠĠĠĠ Ġphone Ġ= Ġphone ĊĠĠĠ Ġ) Ċ Ċ } Ċ