Repo CRUD over /v1 #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #1. Depends on: PgStore JobStore impl
Goal
Expose tracked repos over the API so the dashboard can manage them.
tireless-apicurrently serves only
/v1/healthand/v1/ready.Stage 1's done-when requires that a repo's schedule can be changed from the
dashboard without a redeploy, so this is not optional plumbing — it is the
reason the dashboard exists (design.md §7, stage 1).
Files
crates/tireless-api/src/main.rs— router wiring, state carrying the storecrates/tireless-api/src/routes/repo.rs— new; the handlerscrates/tireless-api/src/error.rs— new; maptireless_entities::Errortostatus codes in one place rather than per handler
crates/tireless-api/Cargo.toml— add sqlx/pool wiring if neededSteps
Config::database_url()and put thestore in router state.
GET /v1/repos— list tracked repos.POST /v1/repos— add one, taking forge, owner, repo, clone URL and defaultbranch. Reject a duplicate with
409rather than a500.PATCH /v1/repos/:id— edit the schedule: interval, quiet window, enabled.Clamp the interval with
Poll::clampserver-side; a client must not be ableto poll faster than the floor.
DELETE /v1/repos/:id./v1/readyreport the database asokonce a real round-trip succeeds,replacing the
not_implementedplaceholder that is there now.Acceptance
cargo test --workspacecargo clippy --all-targets --all-features -- -D warningsPATCHwith an interval below the floor stores the floor, notthe requested value.
409.curl -fsS localhost:23296/v1/readyreportsdatabase: "ok"against a livedatabase.
Out of scope
(design.md §3.4); adding auth here would imply a second user, which is the
thing that must not exist.