mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add backend logic for determining tasks tab visibility (#18401)
This PR implements the backend logic for determining if the Tasks tab should be visible in the web UI as described in [the RFC](https://www.notion.so/coderhq/Coder-Tasks-207d579be5928053ab68c8d9a4b59eaa?source=copy_link#210d579be5928013ab5acbe69a2f548b). The frontend component will be added in a follow-up PR once the entire Tasks backend is implemented so as not to break the dogfood environment until then.
This commit is contained in:
@@ -11806,6 +11806,18 @@ func (q *sqlQuerier) GetTemplateVersionsCreatedAfter(ctx context.Context, create
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const hasTemplateVersionsWithAITask = `-- name: HasTemplateVersionsWithAITask :one
|
||||
SELECT EXISTS (SELECT 1 FROM template_versions WHERE has_ai_task = TRUE)
|
||||
`
|
||||
|
||||
// Determines if the template versions table has any rows with has_ai_task = TRUE.
|
||||
func (q *sqlQuerier) HasTemplateVersionsWithAITask(ctx context.Context) (bool, error) {
|
||||
row := q.db.QueryRowContext(ctx, hasTemplateVersionsWithAITask)
|
||||
var exists bool
|
||||
err := row.Scan(&exists)
|
||||
return exists, err
|
||||
}
|
||||
|
||||
const insertTemplateVersion = `-- name: InsertTemplateVersion :exec
|
||||
INSERT INTO
|
||||
template_versions (
|
||||
|
||||
Reference in New Issue
Block a user