Initial Commit

This commit is contained in:
2026-04-04 23:22:30 -04:00
commit 246f7357a9
61 changed files with 4792 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
#[derive(Debug, Serialize, Deserialize, FromRow)]
pub struct User {
pub id: String,
pub username: String,
#[serde(skip_serializing)]
pub password_hash: String,
}
#[derive(Debug, Serialize, Deserialize, FromRow)]
pub struct Folder {
pub id: String,
pub owner_id: String,
pub parent_id: Option<String>,
pub name: String,
pub created_at: chrono::NaiveDateTime,
}
#[derive(Debug, Serialize, Deserialize, FromRow)]
pub struct File {
pub id: String,
pub owner_id: String,
pub document_id: Option<String>,
pub folder_id: Option<String>,
pub name: String,
pub mime_type: String,
pub created_at: chrono::NaiveDateTime,
}
#[derive(Debug, Serialize, Deserialize, FromRow)]
pub struct Document {
pub id: String,
pub owner_id: String,
pub folder_id: Option<String>,
pub title: String,
#[serde(skip_serializing)]
pub content: Option<Vec<u8>>,
pub thumbnail_svg: Option<String>,
pub created_at: chrono::NaiveDateTime,
pub updated_at: chrono::NaiveDateTime,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RegisterRequest {
pub username: String,
pub password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct LoginRequest {
pub username: String,
pub password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UpdateProfileRequest {
pub username: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChangePasswordRequest {
pub current_password: String,
pub new_password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CreateFolderRequest {
pub name: String,
pub parent_id: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CreateDocumentRequest {
pub title: String,
pub folder_id: Option<String>,
pub content: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UpdateDocumentRequest {
pub title: Option<String>,
pub folder_id: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UpdateFileRequest {
pub name: Option<String>,
pub folder_id: Option<String>,
}