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.

509 B
Raw Blame
use sqlx::{Postgres, Transaction};

/// Tracks a document view
#[tracing::instrument(skip(transaction))]
pub async fn track_document(
    transaction: &mut Transaction<'_, Postgres>,
    document_id: &str,
    user_id: Option<&str>,
) -> anyhow::Result<()> {
    sqlx::query!(
        r#"
        INSERT INTO "DocumentView" ("document_id", "user_id", "created_at")
        VALUES ($1, $2, NOW())
    "#,
        document_id,
        user_id
    )
    .execute(transaction.as_mut())
    .await?;

    Ok(())
}