server: openapi fixes

This commit is contained in:
nym21
2025-12-16 18:03:23 +01:00
parent 593af69230
commit f7f065c6e0
44 changed files with 279 additions and 286 deletions

View File

@@ -5,7 +5,7 @@ use axum::{
response::Redirect,
routing::get,
};
use brk_types::{Transaction, TxOutspend, TxStatus, TxidPath, TxidVoutPath};
use brk_types::{Transaction, TxOutspend, TxStatus, TxidParam, TxidVout};
use crate::{CacheStrategy, extended::TransformResponseExtended};
@@ -25,7 +25,7 @@ impl TxRoutes for ApiRouter<AppState> {
get_with(
async |
headers: HeaderMap,
Path(txid): Path<TxidPath>,
Path(txid): Path<TxidParam>,
State(state): State<AppState>
| {
state.cached_json(&headers, CacheStrategy::Height, move |q| q.transaction(txid)).await
@@ -48,7 +48,7 @@ impl TxRoutes for ApiRouter<AppState> {
get_with(
async |
headers: HeaderMap,
Path(txid): Path<TxidPath>,
Path(txid): Path<TxidParam>,
State(state): State<AppState>
| {
state.cached_json(&headers, CacheStrategy::Height, move |q| q.transaction_status(txid)).await
@@ -71,7 +71,7 @@ impl TxRoutes for ApiRouter<AppState> {
get_with(
async |
headers: HeaderMap,
Path(txid): Path<TxidPath>,
Path(txid): Path<TxidParam>,
State(state): State<AppState>
| {
state.cached_text(&headers, CacheStrategy::Height, move |q| q.transaction_hex(txid)).await
@@ -94,10 +94,10 @@ impl TxRoutes for ApiRouter<AppState> {
get_with(
async |
headers: HeaderMap,
Path(path): Path<TxidVoutPath>,
Path(path): Path<TxidVout>,
State(state): State<AppState>
| {
let txid = TxidPath { txid: path.txid };
let txid = TxidParam { txid: path.txid };
state.cached_json(&headers, CacheStrategy::Height, move |q| q.outspend(txid, path.vout)).await
},
|op| op
@@ -118,7 +118,7 @@ impl TxRoutes for ApiRouter<AppState> {
get_with(
async |
headers: HeaderMap,
Path(txid): Path<TxidPath>,
Path(txid): Path<TxidParam>,
State(state): State<AppState>
| {
state.cached_json(&headers, CacheStrategy::Height, move |q| q.outspends(txid)).await