- Added `FilePreviewer` component to handle different file types (images, markdown, PDFs, and text). - Integrated `react-easy-crop` for image cropping in `ImagePreview`. - Implemented PDF viewing with pagination using `react-pdf`. - Updated `FilesComponent` to support file previews and downloads. - Refactored API calls to use a centralized `apiCall` function for better token management. - Enhanced `Login` and `Register` components to utilize the new API client. - Removed unused theme toggle functionality from `SettingsComponent`. - Improved shared files display in `ShareComponent` with a table layout. - Added error handling and loading states for file operations. - Updated dependencies in `package.json` for new features.
32 lines
833 B
Rust
32 lines
833 B
Rust
use serde::{Serialize, Deserialize};
|
|
use chrono::{DateTime, Utc};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct User {
|
|
pub id: Option<i32>,
|
|
pub name: String,
|
|
pub password_hash: String,
|
|
pub role: String,
|
|
pub quota: Option<i64>, // bytes
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct File {
|
|
pub id: i32,
|
|
pub user_id: Option<i32>,
|
|
pub original_name: String,
|
|
pub storage_path: String,
|
|
pub uploaded_at: DateTime<Utc>,
|
|
pub size: i64,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct Share {
|
|
pub id: Uuid,
|
|
pub file_id: Option<i32>, // Changed to Option<i32>
|
|
pub shared_by: i32,
|
|
pub created_at: DateTime<Utc>,
|
|
pub expires_at: Option<chrono::NaiveDateTime>,
|
|
} |