Identify users in amplitude via a separate 'metrics_id' UUID

This commit is contained in:
Max Brunsfeld 2022-09-29 12:32:25 -07:00
parent efdedaab53
commit 5d09083a7d
13 changed files with 316 additions and 239 deletions

View file

@ -205,7 +205,8 @@ impl Server {
.add_request_handler(Server::follow)
.add_message_handler(Server::unfollow)
.add_message_handler(Server::update_followers)
.add_request_handler(Server::get_channel_messages);
.add_request_handler(Server::get_channel_messages)
.add_request_handler(Server::get_private_user_info);
Arc::new(server)
}
@ -1727,6 +1728,20 @@ impl Server {
Ok(())
}
async fn get_private_user_info(
self: Arc<Self>,
request: TypedEnvelope<proto::GetPrivateUserInfo>,
response: Response<proto::GetPrivateUserInfo>,
) -> Result<()> {
let user_id = self
.store()
.await
.user_id_for_connection(request.sender_id)?;
let metrics_id = self.app_state.db.get_user_metrics_id(user_id).await?;
response.send(proto::GetPrivateUserInfoResponse { metrics_id })?;
Ok(())
}
pub(crate) async fn store(&self) -> StoreGuard<'_> {
#[cfg(test)]
tokio::task::yield_now().await;