Skip to main content

stormchaser_api/db/
approval.rs

1use serde_json::Value;
2use sqlx::PgPool;
3use stormchaser_model::StepInstanceId;
4
5/// Inserts a record into the approval registry.
6/// Insert approval registry.
7pub async fn insert_approval_registry(
8    pool: &PgPool,
9    id: stormchaser_model::EventId,
10    step_id: StepInstanceId,
11    user_id: &str,
12    status: &str,
13    payload: &Value,
14) -> Result<(), sqlx::Error> {
15    sqlx::query(
16        "INSERT INTO approval_registry (id, step_instance_id, user_id, status, payload) VALUES ($1, $2, $3, $4, $5)"
17    )
18    .bind(id)
19    .bind(step_id)
20    .bind(user_id)
21    .bind(status)
22    .bind(payload)
23    .execute(pool)
24    .await?;
25    Ok(())
26}