admin-api

module
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT

README

SweetRPG Admin API

CI License Issues PRs Dependabot

HTTP microservice for the SweetRPG platform's cross-cutting admin concerns. The first capability is banner messages: platform-, service-, or page-scoped notices with a severity and a required expiration, served to any frontend that wants to render them. A thin Gin-based layer: server/*.go wires routes directly to MongoDB via mongodb.go's generic CRUD functions.

API

  • POST /banners - create a banner message.
  • GET /banners?scope=platform&scope=service:catalog&scope=page:/catalog/browse - list active banners matching any of the given scopes, most-severe-first. Platform-scoped banners are always included regardless of the requested scopes.
  • PUT /banners/{id} - update a banner message.
  • DELETE /banners/{id} - delete a banner message.

expires_at is required on create; a banner without one is rejected. Expired documents are also physically removed by a MongoDB TTL index on expires_at.

Run locally

scripts/run-docker-local.sh

Brings up the service plus its MongoDB dependency via docker/docker-compose.yml. Swagger UI is served at /swagger/index.html once running.

Documentation

Package documentation: pkg.go.dev/github.com/sweetrpg/admin-api.

Swagger UI (swaggo/swag + gin-swagger, generated from handler annotations, not hand-written): /swagger/index.html against whatever host you're running against.

Contributing

See CONTRIBUTING.md for the development workflow.

Directories

Path Synopsis
cmd
admin-api command
backfill-audit-fields command
Command backfill-audit-fields stamps the platform audit fields (PADR-0001) on admin-api's pre-convention documents: updated_by on banners, and created_by / updated_by on maintenance_modes.
Command backfill-audit-fields stamps the platform audit fields (PADR-0001) on admin-api's pre-convention documents: updated_by on banners, and created_by / updated_by on maintenance_modes.
backfill-canonical-user-ids command
Command backfill-canonical-user-ids rewrites legacy Auth0-subject values in the banners and maintenance_modes audit fields (created_by, updated_by) to the canonical users._id each subject maps to, using users-api's internal resolve-subjects batch endpoint.
Command backfill-canonical-user-ids rewrites legacy Auth0-subject values in the banners and maintenance_modes audit fields (created_by, updated_by) to the canonical users._id each subject maps to, using users-api's internal resolve-subjects batch endpoint.
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
Package feedback implements the anonymous-feedback-to-GitHub-Issue proxy: a single IssueCreator interface backed by the GitHub Issues API, kept separate from the HTTP handler in server/feedback.go so the handler can be unit-tested against a fake creator.
Package feedback implements the anonymous-feedback-to-GitHub-Issue proxy: a single IssueCreator interface backed by the GitHub Issues API, kept separate from the HTTP handler in server/feedback.go so the handler can be unit-tested against a fake creator.
Package models defines the persisted document shapes for admin-api.
Package models defines the persisted document shapes for admin-api.
middleware
Package middleware provides Gin middleware for admin-api's route groups.
Package middleware provides Gin middleware for admin-api's route groups.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL