catalog-api

module
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT

README

SweetRPG Catalog API

CI Coverage License Issues PRs Dependabot Deployment

HTTP microservice for the SweetRPG Catalog domain (licenses, volumes, contributions, persons, publishers, reviews, studios, systems). A thin Gin-based layer: server/*.go wires JSON:API routes to catalog-data.go's data-access functions.

Run locally

scripts/run-docker-local.sh

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

Known gaps

  • catalog-data.go's Volume entity is the only one with a write path, and Update/Delete are still // TODO stubs there. Every other entity is read-only.
  • No test coverage in server/ or cmd/ yet.

Documentation

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

Swagger UI (swaggo/swag + gin-swagger, generated from handler annotations, not hand-written): api.catalog.dev.sweetrpg.com/swagger/index.html in dev, or /swagger/index.html against whatever host you're running locally.

Test coverage reports are published to sweetrpg.github.io/catalog-api/coverage.html on every merge to develop.

Contributing

See CONTRIBUTING.md for the development workflow and RELEASE.md for how versions get cut.

Directories

Path Synopsis
Package assets is a minimal client for assets-web's authenticated asset store (GET/POST/DELETE /asset/<kind>/<id>), used to promote a staged cover/sample to live (or reclaim it) on volume edit session finalize/accept/reject.
Package assets is a minimal client for assets-web's authenticated asset store (GET/POST/DELETE /asset/<kind>/<id>), used to promote a staged cover/sample to live (or reclaim it) on volume edit session finalize/accept/reject.
Package authz calls auth-api's POST /authz/check to verify a caller's bearer token and resolve their roles, and provides Gin middleware that gates a route on holding one of a set of allowed roles.
Package authz calls auth-api's POST /authz/check to verify a caller's bearer token and resolve their roles, and provides Gin middleware that gates a route on holding one of a set of allowed roles.
Package cachettl resolves the cache TTL for a given route group, loaded once at startup from the CACHE_TTLS env var so slower-changing entities and faster-changing ones aren't forced onto the same cache policy.
Package cachettl resolves the cache TTL for a given route group, loaded once at startup from the CACHE_TTLS env var so slower-changing entities and faster-changing ones aren't forced onto the same cache policy.
cmd
catalog-api command
migrate-volumes command
Command migrate-volumes is the one-time cutover for catalog-entity-versioning's volume meta+version data model (see openspec's design.md Migration Plan).
Command migrate-volumes is the one-time cutover for catalog-entity-versioning's volume meta+version data model (see openspec's design.md Migration Plan).
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
Package editsession reads/deletes the shared, session-backed volume edit state that catalog-web writes to Redis (REDIS_DB=2 on catalog-api's own Redis instance - see docs/frontend-conventions.md's edit-session schema in sweetrpg/platform).
Package editsession reads/deletes the shared, session-backed volume edit state that catalog-web writes to Redis (REDIS_DB=2 on catalog-api's own Redis instance - see docs/frontend-conventions.md's edit-session schema in sweetrpg/platform).
Package proposedchanges stores field-level proposed edits to a record (a volume today, other record types later - see design.md's "generic proposed-change shape" decision) separately from the live record until an editor/admin reviews them.
Package proposedchanges stores field-level proposed edits to a record (a volume today, other record types later - see design.md's "generic proposed-change shape" decision) separately from the live record until an editor/admin reviews them.
Package ratelimit implements a Redis-backed, per-client, per-route-tier request rate limiter.
Package ratelimit implements a Redis-backed, per-client, per-route-tier request rate limiter.
Package readiness tracks the reachability of backend dependencies (beyond Mongo, which api-core.go's HealthHandler already covers) so /status/health can fail loud instead of the service silently degrading to an uncached or unlimited mode.
Package readiness tracks the reachability of backend dependencies (beyond Mongo, which api-core.go's HealthHandler already covers) so /status/health can fail loud instead of the service silently degrading to an uncached or unlimited mode.
Package submissioncap tracks the per-user override on how many pending (unapproved) proposed changes a submitter may have open at once - checked at volume edit session finalize time (durable-volume-editing task 5.1, sweetrpg/platform#38).
Package submissioncap tracks the per-user override on how many pending (unapproved) proposed changes a submitter may have open at once - checked at volume edit session finalize time (durable-volume-editing task 5.1, sweetrpg/platform#38).
Package vocabularies stores the shared, growable "pick-or-add" lists used across volume editing (contribution types, property names, formats) - one generic mechanism instead of three near-duplicate collections, per durable-volume-editing's design.md.
Package vocabularies stores the shared, growable "pick-or-add" lists used across volume editing (contribution types, property names, formats) - one generic mechanism instead of three near-duplicate collections, per durable-volume-editing's design.md.

Jump to

Keyboard shortcuts

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