import dsqlCrud from "../../../utils/data-fetching/crud";
import {
    DSQL_DATASQUIREL_PROCESS_QUEUE,
    DsqlTables,
} from "../../../types/dsql";

type Param = {
    queueId: string | number;
    queue: DSQL_DATASQUIREL_PROCESS_QUEUE;
};

export default async function updateQueue({ queueId, queue }: Param) {
    const tableName: (typeof DsqlTables)[number] = "process_queue";

    const updateQueueRes = await dsqlCrud<DSQL_DATASQUIREL_PROCESS_QUEUE>({
        action: "update",
        table: tableName,
        targetId: queueId,
        data: queue,
    });

    return Boolean(updateQueueRes?.success);
}
