14 lines
360 B
Rust
14 lines
360 B
Rust
|
|
pub async fn get_organization(
|
|
Org(org_ctx): Org,
|
|
State(pool): State<PgPool>,
|
|
) -> Result<Json<Organization>, StatusCode> {
|
|
let org = sqlx::query_as::<_, Organization>("SELECT * FROM organizations WHERE id = $1")
|
|
.bind(org_ctx.id)
|
|
.fetch_one(&pool)
|
|
.await
|
|
.map_err(|_| StatusCode::NOT_FOUND)?;
|
|
|
|
Ok(Json(org))
|
|
}
|