- Add HTTP handlers for issues, comments, agents, workspaces, inbox, members, and activity - Implement JWT authentication middleware with Bearer token validation - Add sqlc queries for all entities (CRUD operations) - Extract router into reusable NewRouter() for testability - Expand SDK with full API client methods (CRUD for all resources) - Add updateWorkspace to SDK, add Member type to shared types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
741 B
SQL
30 lines
741 B
SQL
-- name: ListWorkspaces :many
|
|
SELECT w.* FROM workspace w
|
|
JOIN member m ON m.workspace_id = w.id
|
|
WHERE m.user_id = $1
|
|
ORDER BY w.created_at ASC;
|
|
|
|
-- name: GetWorkspace :one
|
|
SELECT * FROM workspace
|
|
WHERE id = $1;
|
|
|
|
-- name: GetWorkspaceBySlug :one
|
|
SELECT * FROM workspace
|
|
WHERE slug = $1;
|
|
|
|
-- name: CreateWorkspace :one
|
|
INSERT INTO workspace (name, slug, description)
|
|
VALUES ($1, $2, $3)
|
|
RETURNING *;
|
|
|
|
-- name: UpdateWorkspace :one
|
|
UPDATE workspace SET
|
|
name = COALESCE(sqlc.narg('name'), name),
|
|
description = COALESCE(sqlc.narg('description'), description),
|
|
settings = COALESCE(sqlc.narg('settings'), settings),
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: DeleteWorkspace :exec
|
|
DELETE FROM workspace WHERE id = $1;
|