OpenAPI spec at /api/docs with a Scalar viewer, opt-in via FEAT_API_DOCS
This commit is contained in:
251 files changed
+32497
-66
No files matched your search
@@ -3,6 +3,22 @@ import { getContainerEvents, getContainerEventContainers, getContainerEventActio
|
||||
import { authorize } from '$lib/server/authorize';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* summary: Query container activity events with filters and pagination
|
||||
* query: environmentId:integer Filter to a single environment (from GET /api/environments)
|
||||
* query: containerId:string Filter by container ID (from GET /api/containers)
|
||||
* query: containerName:string Filter by container name
|
||||
* query: actions:string Comma-separated event actions to filter by
|
||||
* query: labels:string Comma-separated labels to filter by
|
||||
* query: fromDate:string Start of the date range (ISO 8601)
|
||||
* query: toDate:string End of the date range (ISO 8601)
|
||||
* query: limit:integer Maximum number of events to return
|
||||
* query: offset:integer Number of events to skip (pagination)
|
||||
* resp-200: {events:array<{id:integer!, containerName:string, action:string, timestamp:string}>, total:integer!, limit:integer!, offset:integer!}
|
||||
* resp-403: Permission denied (requires the activity:view permission)
|
||||
* resp-500: Failed to fetch container events
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ url, cookies }) => {
|
||||
const auth = await authorize(cookies);
|
||||
|
||||
@@ -69,6 +85,14 @@ export const GET: RequestHandler = async ({ url, cookies }) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* summary: Clear all stored container activity events
|
||||
* resp-200: {success:boolean!}
|
||||
* resp-200-example: {"success":true}
|
||||
* resp-403: Permission denied (requires the activity:delete permission)
|
||||
* resp-500: Failed to clear container events
|
||||
*/
|
||||
export const DELETE: RequestHandler = async ({ cookies }) => {
|
||||
const auth = await authorize(cookies);
|
||||
|
||||
|
||||
@@ -3,6 +3,15 @@ import { getContainerEventContainers } from '$lib/server/db';
|
||||
import { authorize } from '$lib/server/authorize';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* summary: List distinct container names that appear in the activity log, for filter dropdowns
|
||||
* query: environment_id:integer Filter to a single environment (from GET /api/environments)
|
||||
* resp-200: array<string>
|
||||
* resp-200-example: ["web-1","db-1","cache-1"]
|
||||
* resp-403: Permission denied (requires the activity:view permission)
|
||||
* resp-500: Failed to fetch container names
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ url, cookies }) => {
|
||||
const auth = await authorize(cookies);
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@ import { authorize } from '$lib/server/authorize';
|
||||
import { json } from '@sveltejs/kit';
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* summary: Stream live container activity and environment-status events over Server-Sent Events
|
||||
* resp-200: Server-Sent Events stream (text/event-stream) emitting connected, heartbeat, activity and env_status events
|
||||
* resp-403: Permission denied (requires the activity:view permission)
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ cookies }) => {
|
||||
const auth = await authorize(cookies);
|
||||
|
||||
|
||||
@@ -3,6 +3,15 @@ import { getContainerEventStats } from '$lib/server/db';
|
||||
import { authorize } from '$lib/server/authorize';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* summary: Get aggregate container activity statistics (totals and counts by action)
|
||||
* query: environment_id:integer Filter to a single environment (from GET /api/environments)
|
||||
* resp-200: {total:integer!, today:integer!, byAction:{}}
|
||||
* resp-200-example: {"total":128,"today":7,"byAction":{"start":40,"stop":30}}
|
||||
* resp-403: Permission denied (requires the activity:view permission)
|
||||
* resp-500: Failed to fetch stats
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ url, cookies }) => {
|
||||
const auth = await authorize(cookies);
|
||||
|
||||
|
||||
Reference in new issue
Block a user