Build out the admin panel

- Overview: users, organizations, workspaces, spaces, pages, files and
  storage (org admins see their organization), plus pages open right now,
  the search index size, and version, uptime and database health.
- Users: invite people by email (with resend, revoke and a copyable link
  when mail fails) and send a password-reset email.
- Authentication: sign-up on or off, the email-domain allow-list, and
  sign-in links by email.
- Branding: instance name, accent colour and logo. The web app shows them
  on the sign-in pages and applies the accent colour everywhere.
- Email and Storage: SMTP and S3 settings with test buttons.
- Maintenance: create, download and delete database backups, and a view
  of the background jobs with their last run, duration and errors.

On the server, a small jobs registry records each search-indexing pass,
and "search.rebuild" replaces the separate reindex endpoint. A new
instance package serves the dashboard numbers, health and backups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-10-31 17:34:48 +01:00
1 parent 92cd81fd96
commit ffc6cc4fbc
31 files changed
+2326 -134

No files matched your search

+153 -9
View File
@@ -1382,15 +1382,6 @@ paths:
application/json:
schema: { $ref: "#/components/schemas/SearchResult" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/search/reindex:
post:
operationId: reindexSearch
tags: [search]
summary: Rebuild the search index from the database (superadmin)
security: [{ bearer: [] }]
responses:
"202": { description: Started }
"403": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/export:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
@@ -1608,6 +1599,106 @@ paths:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/stats:
get:
operationId: getAdminStats
tags: [admin]
summary: Dashboard numbers (superadmin - the instance; admin - their organization)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AdminStats" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/health:
get:
operationId: getAdminHealth
tags: [admin]
summary: Version, uptime and database health (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AdminHealth" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/jobs:
get:
operationId: listJobs
tags: [admin]
summary: Background jobs and how their last run went (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Job" } }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/jobs/{name}/run:
parameters:
- { name: name, in: path, required: true, schema: { type: string } }
post:
operationId: runJob
tags: [admin]
summary: Start a runnable job now (superadmin)
security: [{ bearer: [] }]
responses:
"202": { description: Started }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/admin/backups:
get:
operationId: listBackups
tags: [admin]
summary: Database backups kept by docwell-db (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/Backup" } }
"403": { $ref: "#/components/responses/Error" }
post:
operationId: createBackup
tags: [admin]
summary: Write a new backup of the database and its files (superadmin)
description: Answers when the archive is complete, which can take a while on large instances.
security: [{ bearer: [] }]
responses:
"204": { description: Created }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/backups/{key}:
parameters:
- { name: key, in: path, required: true, schema: { type: string } }
get:
operationId: downloadBackup
tags: [admin]
summary: Download a backup archive (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: The archive
content:
application/zip:
schema: { type: string, format: binary }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteBackup
tags: [admin]
summary: Delete a backup archive (superadmin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
components:
securitySchemes:
bearer:
@@ -2085,3 +2176,56 @@ components:
description: As sent when the comment was created; null when there was none
created: { type: string }
canDelete: { type: boolean }
AdminStats:
type: object
required: [scope, users, organizations, workspaces, spaces, pages, attachments, storageBytes, rooms, editors, indexed]
properties:
scope: { type: string, enum: [instance, organization] }
users: { type: integer }
organizations: { type: integer }
workspaces: { type: integer }
spaces: { type: integer }
pages: { type: integer, description: Pages outside the trash }
attachments: { type: integer }
storageBytes: { type: integer, description: Total size of attachments }
rooms: { type: integer, description: Pages open for editing now (instance scope only) }
editors: { type: integer, description: People connected to those pages (instance scope only) }
indexed: { type: integer, description: Pages in the search index (instance scope only) }
AdminHealth:
type: object
required: [version, goVersion, started, uptimeSeconds, database, goroutines, memoryMb]
properties:
version: { type: string }
goVersion: { type: string }
started: { type: string, format: date-time }
uptimeSeconds: { type: integer }
database:
type: object
required: [ok, latencyMs]
properties:
ok: { type: boolean }
latencyMs: { type: integer }
error: { type: string }
goroutines: { type: integer }
memoryMb: { type: integer }
Job:
type: object
required: [name, description, every, runnable, running, runs, failures, lastStarted, lastDurationMs, lastError]
properties:
name: { type: string }
description: { type: string }
every: { type: string, description: How often it runs on its own (Go duration); empty when only on demand }
runnable: { type: boolean, description: Can be started by hand }
running: { type: boolean }
runs: { type: integer, description: Runs since the server started }
failures: { type: integer }
lastStarted: { type: string, description: RFC 3339; empty before the first run }
lastDurationMs: { type: integer }
lastError: { type: string }
Backup:
type: object
required: [key, size, modified]
properties:
key: { type: string }
size: { type: integer }
modified: { type: string }