Extract responses
This commit is contained in:
parent
f803ec0da5
commit
fe8d236948
3 changed files with 21 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ mod fetch_latest_document_version;
|
||||||
mod fetch_latest_documents;
|
mod fetch_latest_documents;
|
||||||
mod ping;
|
mod ping;
|
||||||
mod requests;
|
mod requests;
|
||||||
|
mod responses;
|
||||||
mod update_document;
|
mod update_document;
|
||||||
|
|
||||||
pub async fn create_server(app_state: AppState) -> Result<()> {
|
pub async fn create_server(app_state: AppState) -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ use axum_extra::{
|
||||||
TypedHeader,
|
TypedHeader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::auth::auth;
|
use super::{auth::auth, responses::PingResponse};
|
||||||
use crate::{app_state::AppState, database::models::PingResponse, errors::SyncServerError};
|
use crate::{app_state::AppState, errors::SyncServerError};
|
||||||
|
|
||||||
#[axum::debug_handler]
|
#[axum::debug_handler]
|
||||||
pub async fn ping(
|
pub async fn ping(
|
||||||
|
|
|
||||||
18
backend/sync_server/src/server/responses.rs
Normal file
18
backend/sync_server/src/server/responses.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
use schemars::JsonSchema;
|
||||||
|
use serde::{self, Serialize};
|
||||||
|
|
||||||
|
use crate::database::models::{DocumentVersionWithoutContent, VaultUpdateId};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, JsonSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PingResponse {
|
||||||
|
pub server_version: String,
|
||||||
|
pub is_authenticated: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, JsonSchema)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct FetchLatestDocumentsResponse {
|
||||||
|
pub latest_documents: Vec<DocumentVersionWithoutContent>,
|
||||||
|
pub last_update_id: VaultUpdateId,
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue