Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

888 B
Raw Blame
/// Gets whether the organization is allow list only
pub async fn get_allow_list_only(
    db: sqlx::Pool<sqlx::Postgres>,
    organization_id: i32,
) -> Result<bool, sqlx::Error> {
    let result = sqlx::query!(
        r#"
        SELECT "allowListOnly" as allow_list_only
        FROM "Organization"
        WHERE id = $1
        "#,
        organization_id
    )
    .map(|row| row.allow_list_only.unwrap_or(false))
    .fetch_one(&db)
    .await?;

    Ok(result)
}

#[tracing::instrument(skip(db))]
pub async fn get_organization_name(
    db: &sqlx::Pool<sqlx::Postgres>,
    organization_id: i32,
) -> anyhow::Result<String> {
    let result = sqlx::query!(
        r#"
        SELECT
            name
        FROM
            "Organization"
        WHERE id = $1
        "#,
        organization_id
    )
    .map(|row| row.name)
    .fetch_one(db)
    .await?;

    Ok(result)
}