pub fn find_user_by_uid(
    uid: Uuid,
    conn: &PgConnection,
) -> Result<Option<models::User>, StatusCode> {
    use crate::schema::users::dsl::*;

    let user = users
        .filter(user_id.eq(uid))
        .first::<models::User>(conn)
        .optional()
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;

    Ok(user)
}
/// Find user by user_id. If not found then return None.
Find user by user_id. If not found then return None.
Find user by user_id . If not found then return None .
pub fn find_user_by_uid(
    uid: Uuid,
    conn: &PgConnection,
) -> Result<Option<models::User>, StatusCode> {
    use crate::schema::users::dsl::*;
    let user = users
        .filter(user_id.eq(uid))
        .first::<models::User>(conn)
        .optional()
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
    Ok(user)
}
pub fn find_user_by_uid ( uid : Uuid , conn : & PgConnection , ) -> Result < Option < models :: User > , StatusCode > { use crate :: schema :: users :: dsl :: * ; let user = users . filter ( user_id . eq ( uid ) ) . first :: < models :: User > ( conn ) . optional ( ) . map_err ( | _ | StatusCode :: INTERNAL_SERVER_ERROR ) ? ; Ok ( user ) }
Find user by user_id.
Find user by user_id .
uid
Uuid
conn
&PgConnection
uid
Uuid
conn
&PgConnection