Skip to main content

Module templates

Module templates 

Source
Expand description

Template CRUD routes: GET /api/templates, GET /api/templates/{name}, POST /api/templates, PUT /api/templates/{name}, DELETE /api/templates/{name}.

Mirrors bhtune-cli’s commands::template behavior exactly (see import_one there): validate, then check for a name collision, then insert. HTTP-created templates are always TemplateOrigin::User – the same origin the CLI’s single-template import path assigns, as opposed to the auto-loaded Builtin/Catalog origins, which only ever come from the embedded catalog or a user catalog file, never from this endpoint. PUT is likewise restricted to User-origin rows – see update_template’s doc comment.

Structs§

TemplateResponse
The HTTP-facing shape of a stored template: the caller-supplied DcsTemplate fields flattened alongside the database-assigned id/origin/timestamps. Per this workspace’s established DTO-decoupling convention (see bhtune-cli’s commands::history module doc comments), DcsTemplateRow itself deliberately does not derive Serialize – every JSON-facing consumer builds its own projection rather than the DB row shape leaking straight onto the wire.

Functions§

router