package Ġcom . br aved roid . job by . auth . infrastructure . repositories Ċ Ċ import Ġcom . br aved roid . job by . auth . domain . entities . User Ċ import Ġcom . br aved roid . job by . auth . domain . exceptions . User Email Not Available Exception Ċ import Ġcom . br aved roid . job by . auth . domain . repositories . UserRepository Ċ import Ġcom . br aved roid . job by . auth . infrastructure . entities . User Entity Ċ import Ġcom . br aved roid . job by . auth . infrastructure . entities . to Domain Ċ import Ġorg . springframework . stereotype . Repository Ċ import Ġjavax . transaction . Transactional Ċ Ċ @ Repository Ċ @ Transactional Ċ class ĠUser Repository Impl ( ĊĠĠĠ Ġprivate Ġval Ġuser Jpa Repository : ĠUser Jpa Repository Ċ ) Ġ: ĠUser Repository Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġsave ( user : ĠUser ): ĠUser Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġemail Already Exist Ġ= ĠfindBy Email ( user . email ) Ġ!= Ġnull ĊĠĠĠĠĠĠĠ Ġif Ġ( email Already Exist ) Ġthrow ĠUser Email Not Available Exception ( user . email ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġuser Jpa Repository . save ( user . to Persistence Entity ()). to Domain () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġfind ById ( id : ĠLong ) Ġ= Ġuser Jpa Repository . findById ( id ). get (). to Domain () ĊĊĠĠĠ Ġoverride Ġfun ĠfindBy Email ( email : ĠString ) Ġ= Ġuser Jpa Repository . findBy Email ( email )?. to Domain () ĊĊĠĠĠ Ġprivate Ġfun ĠUser . to Persistence Entity (): ĠUser Entity Ġ= ĠUser Entity ( ĊĠĠĠĠĠĠĠ Ġid = id , ĊĠĠĠĠĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠĠĠĠĠ Ġemail Ġ= Ġemail , ĊĠĠĠĠĠĠĠ Ġpassword Ġ= Ġpassword , ĊĠĠĠ Ġ) Ċ Ċ } ĊĊ