Files
geo/server/internal/tenant/repository/queries/audit.sql
T
root de30497f59 feat: add tenant and user management with migrations, handlers, and tests
- Implemented tenant and user management features including:
  - Tenant creation and management with associated migrations.
  - User creation and management with associated migrations.
  - Tenant membership management with associated migrations.
  - Platform user roles management with associated migrations.
  - Quota management with associated migrations.
  - Article and template management with associated migrations.
- Added HTTP handlers for templates and workspaces.
- Created tests for protected and public routes.
- Introduced a script to check tenant scope in SQL queries.
- Documented task plan for backend completion and frontend foundation.
2026-04-01 00:58:42 +08:00

16 lines
901 B
SQL

-- name: CreateAuditLog :exec
INSERT INTO audit_logs (operator_id, tenant_id, module, action, before_json, after_json, result)
VALUES (sqlc.arg(operator_id), sqlc.arg(tenant_id), sqlc.arg(module), sqlc.arg(action),
sqlc.arg(before_json), sqlc.arg(after_json), sqlc.arg(result));
-- name: CreateGenerationTask :one
INSERT INTO generation_tasks (tenant_id, article_id, quota_reservation_id, task_type, input_params_json, status)
VALUES (sqlc.arg(tenant_id), sqlc.arg(article_id), sqlc.arg(quota_reservation_id),
sqlc.arg(task_type), sqlc.arg(input_params_json), 'queued')
RETURNING id;
-- name: UpdateGenerationTaskStatus :exec
UPDATE generation_tasks SET status = sqlc.arg(status), error_message = sqlc.arg(error_message),
started_at = sqlc.arg(started_at), completed_at = sqlc.arg(completed_at), updated_at = NOW()
WHERE id = sqlc.arg(id) AND tenant_id = sqlc.arg(tenant_id);