Migrate server to CAS only

This commit is contained in:
Andras Schmelczer 2026-09-16 10:36:20 +01:00
commit 1619c51ad9

View file

@ -1,51 +1,23 @@
use axum::body::Bytes;
use axum_typed_multipart::{FieldData, TryFromMultipart};
use crate::app_state::database::models::VaultUpdateId;
use reconcile_text::NumberOrText;
use serde::{self, Deserialize};
use serde::{Deserialize, Serialize};
use ts_rs::TS;
use crate::app_state::database::models::{DocumentId, VaultUpdateId};
#[derive(TS, Debug, TryFromMultipart)]
#[ts(export)]
pub struct CreateDocumentVersion {
/// The client can decide the document id (if it wishes to) in order
/// to help with syncing. If the client does not provide a document id,
/// the server will generate one. If the client provides a document id
/// it must not already exist in the database.
pub document_id: Option<DocumentId>,
pub relative_path: String,
#[ts(as = "Vec<u8>")]
#[form_data(limit = "unlimited")]
pub content: FieldData<Bytes>,
#[derive(TS, Debug, Deserialize, Serialize)]
#[serde(tag = "type", content = "value")]
pub enum PushContent {
Snapshot(String),
Diff(#[ts(type = "Array<number | string>")] Vec<NumberOrText>),
Delete,
}
#[derive(Debug, TryFromMultipart)]
pub struct UpdateBinaryDocumentVersion {
pub parent_version_id: VaultUpdateId,
pub relative_path: String,
#[form_data(limit = "unlimited")]
pub content: FieldData<Bytes>,
}
#[derive(TS, Debug, Deserialize)]
#[derive(TS, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[ts(export)]
pub struct UpdateTextDocumentVersion {
#[ts(as = "i32")]
pub parent_version_id: VaultUpdateId,
pub relative_path: String,
#[ts(type = "Array<number | string>")]
pub content: Vec<NumberOrText>,
}
#[derive(TS, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[ts(export)]
pub struct DeleteDocumentVersion {
pub struct PushDocument {
pub request_id: uuid::Uuid,
#[ts(as = "Option<i32>")]
pub parent_version_id: Option<VaultUpdateId>,
pub relative_path: String,
pub content: PushContent,
}