package Ġru . k uch an ov . gp . service . auth Ċ Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġru . k uch an ov . gp . Gp Constants Ċ import Ġru . k uch an ov . gp . bean . auth . Gp User Ċ import Ġru . k uch an ov . gp . model . dto . User Dto Ċ import Ġru . k uch an ov . gp . repository . auth . Users Repository ĊĊ Ċ @ Service Ċ class ĠG p UserDetails ServiceImpl Ġ@ Autowired Ġconstructor ( ĊĠĠĠ Ġval Ġusers Repository : ĠUsers Repository , ĊĠĠĠ Ġval Ġusers Author ities Service : ĠUsers Author ities Service Ċ ) Ġ: ĠG p UserDetails Service Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll ById ( ids : ĠList < Long >): ĠList < Gp User > Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . findAll ById ( ids ) ĊĊĠĠĠ Ġoverride Ġfun Ġcount Users Created Between Dates ( startDate : ĠString , ĠendDate : ĠString ): ĠInt Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . count Users Created Between Dates ( startDate , ĠendDate ) ĊĊĠĠĠ Ġoverride Ġfun Ġget ById ( id : ĠLong ) Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . findOne ById ( id )?. with Author ities () ĊĊĠĠĠ Ġoverride Ġfun Ġget ById As Dto ( id : ĠLong ): ĠUser Dto ? Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getOne As User Dto ( id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . with Author ities () ĊĊĠĠĠ Ġoverride Ġfun Ġsave ( user : ĠG p User ): ĠG p User Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . save ( user ). with Author ities () ĊĊĠĠĠ Ġoverride Ġfun Ġupdate ( user : ĠG p User ): ĠG p User Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . save ( user ). with Author ities () ĊĊĠĠĠ Ġoverride Ġfun Ġload User By Username ( username : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġusers Repository . findOne By Username ( username )?. with Author ities () ĊĊĠĠĠ Ġoverride Ġfun ĠgetBy Provider Id ( id : ĠString , Ġprovider : ĠG p Constants . Social Provider ) Ġ= ĊĠĠĠĠĠĠĠ Ġwhen Ġ( provider ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG p Constants . Social Provider . GOOGLE Ġ-> Ġusers Repository . findOne By Google Id ( id ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG p Constants . Social Provider . FACE BOOK Ġ-> Ġusers Repository . findOne By Facebook Id ( id ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG p Constants . Social Provider . VK Ġ-> Ġusers Repository . findOne By Vk Id ( id ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG p Constants . Social Provider . GITHUB Ġ-> Ġusers Repository . findOne By Github Id ( id ) ĊĠĠĠĠĠĠĠ Ġ} ?. with Author ities () ĊĊĠĠĠ Ġoverride Ġfun Ġdelete ById ( id : ĠLong ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġusers Author ities Service . delete By UserId ( id ) ĊĠĠĠĠĠĠĠ Ġusers Repository . delete ById ( id ) ĊĠĠĠĠĠĠĠ Ġreturn Ġtrue ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdelete By Username ( username : ĠString ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= Ġload User By Username ( username ) Ġ?: Ġreturn Ġfalse ĊĠĠĠĠĠĠĠ Ġreturn Ġdelete ById ( user . id !! ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠG p User . with Author ities () Ġ= Ġthis . apply Ġ{ ĊĠĠĠĠĠĠĠ Ġuser Author ities Ġ= Ġusers Author ities Service . findAll By UserId ( id !! ). toSet () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠUser Dto . with Author ities () Ġ= Ġthis . apply Ġ{ ĊĠĠĠĠĠĠĠ Ġauthor ities Ġ= Ġusers Author ities Service . findAll By UserId As Dto ( id ) ĊĠĠĠ Ġ} Ċ } Ċ