admin-api

module
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 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
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
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