multidb
This commit is contained in:
+18
-2
@@ -205,7 +205,15 @@ pub async fn history(
|
||||
) -> Result<Json<Vec<db::Revision>>, ApiError> {
|
||||
let (workspace, note) = authorized_note(&state, &workspace_slug, ¬e_slug, payload.password.as_deref()).await?;
|
||||
let _ = workspace;
|
||||
Ok(Json(db::list_revisions(&state.db, note.id).await?))
|
||||
let revisions = db::list_revisions(&state.db, note.id)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|mut revision| {
|
||||
revision.created_at = db::normalize_timestamp(&revision.created_at);
|
||||
revision
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(revisions))
|
||||
}
|
||||
|
||||
pub async fn restore(
|
||||
@@ -434,7 +442,15 @@ pub async fn pad_history(
|
||||
Json(payload): Json<PasswordRequest>,
|
||||
) -> Result<Json<Vec<db::Revision>>, ApiError> {
|
||||
let pad = authorized_pad(&state, &slug, payload.password.as_deref()).await?;
|
||||
Ok(Json(db::list_pad_revisions(&state.db, pad.id).await?))
|
||||
let revisions = db::list_pad_revisions(&state.db, pad.id)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|mut revision| {
|
||||
revision.created_at = db::normalize_timestamp(&revision.created_at);
|
||||
revision
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(revisions))
|
||||
}
|
||||
|
||||
pub async fn pad_restore(
|
||||
|
||||
Reference in New Issue
Block a user