created_at swagger
This commit is contained in:
@@ -108,7 +108,7 @@ pub struct DocumentCheckResponse {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub version_number: Option<i32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub uploaded_at: Option<String>,
|
||||
pub created_at: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
@@ -136,7 +136,7 @@ pub struct DocumentResponse {
|
||||
pub original_name: String,
|
||||
pub content_type: Option<String>,
|
||||
pub folder_id: Option<Uuid>,
|
||||
pub uploaded_at: String,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub deleted_at: Option<String>,
|
||||
pub issued_at: Option<String>,
|
||||
@@ -554,14 +554,14 @@ pub async fn list_documents(
|
||||
|
||||
if !by_id.is_empty() {
|
||||
let mut remaining: Vec<Document> = by_id.into_values().collect();
|
||||
remaining.sort_by(|a, b| b.uploaded_at.cmp(&a.uploaded_at));
|
||||
remaining.sort_by(|a, b| b.created_at.cmp(&a.created_at));
|
||||
ordered.extend(remaining);
|
||||
}
|
||||
|
||||
ordered
|
||||
} else {
|
||||
docs_query
|
||||
.order(documents::uploaded_at.desc())
|
||||
.order(documents::created_at.desc())
|
||||
.load(&mut conn)?
|
||||
};
|
||||
|
||||
@@ -627,7 +627,7 @@ pub async fn check_document(
|
||||
filename: Some(document.filename.clone()),
|
||||
version_id: Some(version.id),
|
||||
version_number: Some(version.version_number),
|
||||
uploaded_at: Some(to_iso(document.uploaded_at)),
|
||||
created_at: Some(to_iso(document.created_at)),
|
||||
}))
|
||||
} else {
|
||||
Ok(Json(DocumentCheckResponse {
|
||||
@@ -637,7 +637,7 @@ pub async fn check_document(
|
||||
filename: None,
|
||||
version_id: None,
|
||||
version_number: None,
|
||||
uploaded_at: None,
|
||||
created_at: None,
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -2190,7 +2190,7 @@ pub(crate) fn to_document_response(
|
||||
original_name: doc.original_name,
|
||||
content_type: doc.content_type,
|
||||
folder_id: doc.folder_id,
|
||||
uploaded_at: to_iso(doc.uploaded_at),
|
||||
created_at: to_iso(doc.created_at),
|
||||
updated_at: to_iso(doc.updated_at),
|
||||
deleted_at: doc.deleted_at.map(to_iso),
|
||||
issued_at: doc.issued_at.map(to_iso),
|
||||
|
||||
Reference in New Issue
Block a user