mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-06 22:09:44 +02:00
* feat(search): implement full-text search for issues Add pg_bigm-based full-text search across issue titles and descriptions, with API endpoint, CLI subcommand, and web Cmd+K search dialog. - Migration 032: pg_bigm extension + GIN indexes on title/description - Server: GET /api/issues/search?q=... with pagination and total count - CLI: `multica issue search <query>` with table/json output - Web: Cmd+K command palette using cmdk, with debounced search Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(search): address review feedback on search implementation 1. Escape LIKE special characters (%, _, \) in handler to prevent matching anomalies from user input. 2. Wire AbortController signal into searchIssues fetch so in-flight requests are actually cancelled on new input. 3. Fix offset=0 falsy check — use !== undefined instead of truthiness. 4. Merge results + count into single query using COUNT(*) OVER() window function, eliminating the duplicate DB round-trip. 5. Exclude done/cancelled issues by default; add include_closed parameter to API, CLI (--include-closed), and web client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(search): default web search to include all statuses Pass include_closed: true in the web Cmd+K search so results include done and cancelled issues by default, matching the reviewer's request. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(search): add comment search with snippet extraction Extend search to cover issue comments in addition to title/description. Results are deduplicated at the issue level, with match_source and matched_snippet fields indicating where and what matched. - Migration 033: pg_bigm GIN index on comment.content - SQL: EXISTS subquery for comment matching, correlated subquery for snippet extraction, 3-tier ranking (title > description > comment) - Server: SearchIssueResponse with match_source and matched_snippet - Web: show comment icon + snippet below issue title when matched - CLI: MATCH column shows source and truncated snippet Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(search): redesign search dialog to match Linear's spacious style - Widen dialog from sm (384px) to xl (576px) with top-20% positioning - Larger search input with icon, generous padding, and ESC hint - Use cmdk primitives directly for full style control - Taller result list (400px / 50vh), spacious result items (py-2.5) - Rounded-lg items with accent highlight on selection - Cleaner border separator between input and results --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
606 lines
16 KiB
Go
606 lines
16 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: issue.sql
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const countIssues = `-- name: CountIssues :one
|
|
SELECT count(*) FROM issue
|
|
WHERE workspace_id = $1
|
|
AND ($2::text IS NULL OR status = $2)
|
|
AND ($3::text IS NULL OR priority = $3)
|
|
AND ($4::uuid IS NULL OR assignee_id = $4)
|
|
`
|
|
|
|
type CountIssuesParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Status pgtype.Text `json:"status"`
|
|
Priority pgtype.Text `json:"priority"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
}
|
|
|
|
func (q *Queries) CountIssues(ctx context.Context, arg CountIssuesParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, countIssues,
|
|
arg.WorkspaceID,
|
|
arg.Status,
|
|
arg.Priority,
|
|
arg.AssigneeID,
|
|
)
|
|
var count int64
|
|
err := row.Scan(&count)
|
|
return count, err
|
|
}
|
|
|
|
const createIssue = `-- name: CreateIssue :one
|
|
INSERT INTO issue (
|
|
workspace_id, title, description, status, priority,
|
|
assignee_type, assignee_id, creator_type, creator_id,
|
|
parent_issue_id, position, due_date, number
|
|
) VALUES (
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13
|
|
) RETURNING id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number
|
|
`
|
|
|
|
type CreateIssueParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Title string `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
Status string `json:"status"`
|
|
Priority string `json:"priority"`
|
|
AssigneeType pgtype.Text `json:"assignee_type"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
CreatorType string `json:"creator_type"`
|
|
CreatorID pgtype.UUID `json:"creator_id"`
|
|
ParentIssueID pgtype.UUID `json:"parent_issue_id"`
|
|
Position float64 `json:"position"`
|
|
DueDate pgtype.Timestamptz `json:"due_date"`
|
|
Number int32 `json:"number"`
|
|
}
|
|
|
|
func (q *Queries) CreateIssue(ctx context.Context, arg CreateIssueParams) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, createIssue,
|
|
arg.WorkspaceID,
|
|
arg.Title,
|
|
arg.Description,
|
|
arg.Status,
|
|
arg.Priority,
|
|
arg.AssigneeType,
|
|
arg.AssigneeID,
|
|
arg.CreatorType,
|
|
arg.CreatorID,
|
|
arg.ParentIssueID,
|
|
arg.Position,
|
|
arg.DueDate,
|
|
arg.Number,
|
|
)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const deleteIssue = `-- name: DeleteIssue :exec
|
|
DELETE FROM issue WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) DeleteIssue(ctx context.Context, id pgtype.UUID) error {
|
|
_, err := q.db.Exec(ctx, deleteIssue, id)
|
|
return err
|
|
}
|
|
|
|
const getIssue = `-- name: GetIssue :one
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetIssue(ctx context.Context, id pgtype.UUID) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, getIssue, id)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getIssueByNumber = `-- name: GetIssueByNumber :one
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE workspace_id = $1 AND number = $2
|
|
`
|
|
|
|
type GetIssueByNumberParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Number int32 `json:"number"`
|
|
}
|
|
|
|
func (q *Queries) GetIssueByNumber(ctx context.Context, arg GetIssueByNumberParams) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, getIssueByNumber, arg.WorkspaceID, arg.Number)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getIssueInWorkspace = `-- name: GetIssueInWorkspace :one
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE id = $1 AND workspace_id = $2
|
|
`
|
|
|
|
type GetIssueInWorkspaceParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
}
|
|
|
|
func (q *Queries) GetIssueInWorkspace(ctx context.Context, arg GetIssueInWorkspaceParams) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, getIssueInWorkspace, arg.ID, arg.WorkspaceID)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const listChildIssues = `-- name: ListChildIssues :many
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE parent_issue_id = $1
|
|
ORDER BY position ASC, created_at DESC
|
|
`
|
|
|
|
func (q *Queries) ListChildIssues(ctx context.Context, parentIssueID pgtype.UUID) ([]Issue, error) {
|
|
rows, err := q.db.Query(ctx, listChildIssues, parentIssueID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []Issue{}
|
|
for rows.Next() {
|
|
var i Issue
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listIssues = `-- name: ListIssues :many
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE workspace_id = $1
|
|
AND ($4::text IS NULL OR status = $4)
|
|
AND ($5::text IS NULL OR priority = $5)
|
|
AND ($6::uuid IS NULL OR assignee_id = $6)
|
|
ORDER BY position ASC, created_at DESC
|
|
LIMIT $2 OFFSET $3
|
|
`
|
|
|
|
type ListIssuesParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Limit int32 `json:"limit"`
|
|
Offset int32 `json:"offset"`
|
|
Status pgtype.Text `json:"status"`
|
|
Priority pgtype.Text `json:"priority"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
}
|
|
|
|
func (q *Queries) ListIssues(ctx context.Context, arg ListIssuesParams) ([]Issue, error) {
|
|
rows, err := q.db.Query(ctx, listIssues,
|
|
arg.WorkspaceID,
|
|
arg.Limit,
|
|
arg.Offset,
|
|
arg.Status,
|
|
arg.Priority,
|
|
arg.AssigneeID,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []Issue{}
|
|
for rows.Next() {
|
|
var i Issue
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listOpenIssues = `-- name: ListOpenIssues :many
|
|
SELECT id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number FROM issue
|
|
WHERE workspace_id = $1
|
|
AND status NOT IN ('done', 'cancelled')
|
|
AND ($2::text IS NULL OR priority = $2)
|
|
AND ($3::uuid IS NULL OR assignee_id = $3)
|
|
ORDER BY position ASC, created_at DESC
|
|
`
|
|
|
|
type ListOpenIssuesParams struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Priority pgtype.Text `json:"priority"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
}
|
|
|
|
func (q *Queries) ListOpenIssues(ctx context.Context, arg ListOpenIssuesParams) ([]Issue, error) {
|
|
rows, err := q.db.Query(ctx, listOpenIssues, arg.WorkspaceID, arg.Priority, arg.AssigneeID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []Issue{}
|
|
for rows.Next() {
|
|
var i Issue
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const searchIssues = `-- name: SearchIssues :many
|
|
SELECT i.id, i.workspace_id, i.title, i.description, i.status, i.priority, i.assignee_type, i.assignee_id, i.creator_type, i.creator_id, i.parent_issue_id, i.acceptance_criteria, i.context_refs, i.position, i.due_date, i.created_at, i.updated_at, i.number,
|
|
COUNT(*) OVER() AS total_count,
|
|
CASE
|
|
WHEN i.title LIKE '%' || $1 || '%' THEN 'title'
|
|
WHEN COALESCE(i.description, '') LIKE '%' || $1 || '%' THEN 'description'
|
|
ELSE 'comment'
|
|
END AS match_source,
|
|
CASE
|
|
WHEN i.title LIKE '%' || $1 || '%' THEN ''
|
|
WHEN COALESCE(i.description, '') LIKE '%' || $1 || '%' THEN ''
|
|
ELSE COALESCE(
|
|
(SELECT c.content FROM comment c
|
|
WHERE c.issue_id = i.id AND c.content LIKE '%' || $1 || '%'
|
|
ORDER BY c.created_at DESC LIMIT 1),
|
|
''
|
|
)
|
|
END AS matched_comment_content
|
|
FROM issue i
|
|
WHERE i.workspace_id = $2
|
|
AND (
|
|
i.title LIKE '%' || $1 || '%'
|
|
OR COALESCE(i.description, '') LIKE '%' || $1 || '%'
|
|
OR EXISTS (
|
|
SELECT 1 FROM comment c
|
|
WHERE c.issue_id = i.id AND c.content LIKE '%' || $1 || '%'
|
|
)
|
|
)
|
|
AND ($3::boolean OR i.status NOT IN ('done', 'cancelled'))
|
|
ORDER BY
|
|
CASE
|
|
WHEN i.title LIKE '%' || $1 || '%' THEN 0
|
|
WHEN COALESCE(i.description, '') LIKE '%' || $1 || '%' THEN 1
|
|
ELSE 2
|
|
END,
|
|
i.updated_at DESC
|
|
LIMIT $5 OFFSET $4
|
|
`
|
|
|
|
type SearchIssuesParams struct {
|
|
Query pgtype.Text `json:"query"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
IncludeClosed bool `json:"include_closed"`
|
|
SearchOffset int32 `json:"search_offset"`
|
|
SearchLimit int32 `json:"search_limit"`
|
|
}
|
|
|
|
type SearchIssuesRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Title string `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
Status string `json:"status"`
|
|
Priority string `json:"priority"`
|
|
AssigneeType pgtype.Text `json:"assignee_type"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
CreatorType string `json:"creator_type"`
|
|
CreatorID pgtype.UUID `json:"creator_id"`
|
|
ParentIssueID pgtype.UUID `json:"parent_issue_id"`
|
|
AcceptanceCriteria []byte `json:"acceptance_criteria"`
|
|
ContextRefs []byte `json:"context_refs"`
|
|
Position float64 `json:"position"`
|
|
DueDate pgtype.Timestamptz `json:"due_date"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Number int32 `json:"number"`
|
|
TotalCount int64 `json:"total_count"`
|
|
MatchSource string `json:"match_source"`
|
|
MatchedCommentContent interface{} `json:"matched_comment_content"`
|
|
}
|
|
|
|
func (q *Queries) SearchIssues(ctx context.Context, arg SearchIssuesParams) ([]SearchIssuesRow, error) {
|
|
rows, err := q.db.Query(ctx, searchIssues,
|
|
arg.Query,
|
|
arg.WorkspaceID,
|
|
arg.IncludeClosed,
|
|
arg.SearchOffset,
|
|
arg.SearchLimit,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []SearchIssuesRow{}
|
|
for rows.Next() {
|
|
var i SearchIssuesRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
&i.TotalCount,
|
|
&i.MatchSource,
|
|
&i.MatchedCommentContent,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const updateIssue = `-- name: UpdateIssue :one
|
|
UPDATE issue SET
|
|
title = COALESCE($2, title),
|
|
description = COALESCE($3, description),
|
|
status = COALESCE($4, status),
|
|
priority = COALESCE($5, priority),
|
|
assignee_type = $6,
|
|
assignee_id = $7,
|
|
position = COALESCE($8, position),
|
|
due_date = $9,
|
|
parent_issue_id = $10,
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number
|
|
`
|
|
|
|
type UpdateIssueParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Title pgtype.Text `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
Status pgtype.Text `json:"status"`
|
|
Priority pgtype.Text `json:"priority"`
|
|
AssigneeType pgtype.Text `json:"assignee_type"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
Position pgtype.Float8 `json:"position"`
|
|
DueDate pgtype.Timestamptz `json:"due_date"`
|
|
ParentIssueID pgtype.UUID `json:"parent_issue_id"`
|
|
}
|
|
|
|
func (q *Queries) UpdateIssue(ctx context.Context, arg UpdateIssueParams) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, updateIssue,
|
|
arg.ID,
|
|
arg.Title,
|
|
arg.Description,
|
|
arg.Status,
|
|
arg.Priority,
|
|
arg.AssigneeType,
|
|
arg.AssigneeID,
|
|
arg.Position,
|
|
arg.DueDate,
|
|
arg.ParentIssueID,
|
|
)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateIssueStatus = `-- name: UpdateIssueStatus :one
|
|
UPDATE issue SET
|
|
status = $2,
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING id, workspace_id, title, description, status, priority, assignee_type, assignee_id, creator_type, creator_id, parent_issue_id, acceptance_criteria, context_refs, position, due_date, created_at, updated_at, number
|
|
`
|
|
|
|
type UpdateIssueStatusParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
func (q *Queries) UpdateIssueStatus(ctx context.Context, arg UpdateIssueStatusParams) (Issue, error) {
|
|
row := q.db.QueryRow(ctx, updateIssueStatus, arg.ID, arg.Status)
|
|
var i Issue
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.WorkspaceID,
|
|
&i.Title,
|
|
&i.Description,
|
|
&i.Status,
|
|
&i.Priority,
|
|
&i.AssigneeType,
|
|
&i.AssigneeID,
|
|
&i.CreatorType,
|
|
&i.CreatorID,
|
|
&i.ParentIssueID,
|
|
&i.AcceptanceCriteria,
|
|
&i.ContextRefs,
|
|
&i.Position,
|
|
&i.DueDate,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Number,
|
|
)
|
|
return i, err
|
|
}
|