11use crate :: apis:: ApiError ;
22use crate :: auth_verifier:: AccessStandard ;
33use crate :: config:: ServerConfig ;
4+ use crate :: db:: DbConn ;
45use crate :: read_after_write:: types:: LocalRecords ;
56use crate :: read_after_write:: util:: { handle_read_after_write, ReadAfterWriteResponse } ;
67use crate :: read_after_write:: viewer:: LocalViewer ;
@@ -20,6 +21,7 @@ pub async fn inner_get_profile(
2021 res : HandlerPipeThrough ,
2122 s3_config : & State < SdkConfig > ,
2223 state_local_viewer : & State < SharedLocalViewer > ,
24+ db : DbConn ,
2325) -> Result < ReadAfterWriteResponse < ProfileViewDetailed > , ApiError > {
2426 let requester: Option < String > = match auth. access . credentials {
2527 None => None ,
@@ -35,6 +37,7 @@ pub async fn inner_get_profile(
3537 get_profile_munge,
3638 s3_config,
3739 state_local_viewer,
40+ db,
3841 )
3942 . await ?;
4043 Ok ( read_afer_write_response)
@@ -44,6 +47,7 @@ pub async fn inner_get_profile(
4447
4548/// Get detailed profile view of an actor. Does not require auth,
4649/// but contains relevant metadata with auth.
50+ #[ tracing:: instrument( skip_all) ]
4751#[ rocket:: get( "/xrpc/app.bsky.actor.getProfile?<actor>" ) ]
4852pub async fn get_profile (
4953 // Handle or DID of account to fetch profile of.
@@ -53,13 +57,16 @@ pub async fn get_profile(
5357 s3_config : & State < SdkConfig > ,
5458 state_local_viewer : & State < SharedLocalViewer > ,
5559 cfg : & State < ServerConfig > ,
60+ db : DbConn ,
5661) -> Result < ReadAfterWriteResponse < ProfileViewDetailed > , ApiError > {
5762 match cfg. bsky_app_view {
5863 None => Err ( ApiError :: AccountNotFound ) ,
59- Some ( _) => match inner_get_profile ( actor, auth, res, s3_config, state_local_viewer) . await {
60- Ok ( response) => Ok ( response) ,
61- Err ( error) => Err ( error) ,
62- } ,
64+ Some ( _) => {
65+ match inner_get_profile ( actor, auth, res, s3_config, state_local_viewer, db) . await {
66+ Ok ( response) => Ok ( response) ,
67+ Err ( error) => Err ( error) ,
68+ }
69+ }
6370 }
6471}
6572
0 commit comments