Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
1.8 KB
Raw Blame
// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.31.1
// source: task_context_receipt.sql

package db

import (
	"context"

	"github.com/jackc/pgx/v5/pgtype"
)

const getTaskContextReceipt = `-- name: GetTaskContextReceipt :one
SELECT task_id, workspace_id, receipt, created_at, updated_at
FROM task_context_receipt
WHERE task_id = $1
`

type GetTaskContextReceiptRow struct {
	TaskID      pgtype.UUID        `json:"task_id"`
	WorkspaceID pgtype.UUID        `json:"workspace_id"`
	Receipt     []byte             `json:"receipt"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
}

func (q *Queries) GetTaskContextReceipt(ctx context.Context, taskID pgtype.UUID) (GetTaskContextReceiptRow, error) {
	row := q.db.QueryRow(ctx, getTaskContextReceipt, taskID)
	var i GetTaskContextReceiptRow
	err := row.Scan(
		&i.TaskID,
		&i.WorkspaceID,
		&i.Receipt,
		&i.CreatedAt,
		&i.UpdatedAt,
	)
	return i, err
}

const upsertTaskContextReceipt = `-- name: UpsertTaskContextReceipt :exec
INSERT INTO task_context_receipt (task_id, workspace_id, issue_id, receipt)
VALUES ($1, $2, $3, $4)
ON CONFLICT (task_id) DO UPDATE
SET receipt = EXCLUDED.receipt,
    updated_at = now()
`

type UpsertTaskContextReceiptParams struct {
	TaskID      pgtype.UUID `json:"task_id"`
	WorkspaceID pgtype.UUID `json:"workspace_id"`
	IssueID     pgtype.UUID `json:"issue_id"`
	Receipt     []byte      `json:"receipt"`
}

// One receipt per task (MUL-9013). A re-report for the same task — the
// fresh-session retry after a rejected resume — replaces the first.
func (q *Queries) UpsertTaskContextReceipt(ctx context.Context, arg UpsertTaskContextReceiptParams) error {
	_, err := q.db.Exec(ctx, upsertTaskContextReceipt,
		arg.TaskID,
		arg.WorkspaceID,
		arg.IssueID,
		arg.Receipt,
	)
	return err
}