Remove path repetition
This commit is contained in:
parent
2536f09cd7
commit
2a7a19fdf0
1 changed files with 65 additions and 149 deletions
|
|
@ -3,36 +3,26 @@ use axum::{
|
|||
extract::{Path, State},
|
||||
};
|
||||
use log::debug;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::VaultPath;
|
||||
use crate::{
|
||||
app_state::{
|
||||
AppState,
|
||||
database::{
|
||||
Database,
|
||||
models::{FileManifest, VaultId},
|
||||
},
|
||||
database::{Database, models::FileManifest},
|
||||
},
|
||||
errors::{SyncServerError, server_error},
|
||||
utils::normalize_vault_id::normalize_vault_id,
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct GetFileManifestPath {
|
||||
#[serde(deserialize_with = "normalize_vault_id")]
|
||||
vault_id: VaultId,
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_file_manifest(
|
||||
Path(path): Path<GetFileManifestPath>,
|
||||
Path(VaultPath(vault_id)): Path<VaultPath>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<FileManifest>, SyncServerError> {
|
||||
debug!("Fetching file manifest for vault `{}`", path.vault_id);
|
||||
debug!("Fetching file manifest for vault `{vault_id}`");
|
||||
|
||||
let mut transaction = state
|
||||
.database
|
||||
.create_readonly_transaction(&path.vault_id)
|
||||
.create_readonly_transaction(&vault_id)
|
||||
.await
|
||||
.map_err(server_error)?;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue