bf7e030cd6
- Add utoipa v5 dependency with ToSchema derives on all REST API DTOs - Annotate free-function handlers with #[utoipa::path] (trash, share, favorites, recent) - Create ApiDoc struct with OpenApi derive registering 37 schemas across 7 tags - Add generate-openapi binary outputting resources/gen/openapi.json - Serve OpenAPI spec at GET /api/openapi.json (public, no auth) - Add justfile with common dev commands (build, test, lint, check, openapi, db)
41 lines
1.2 KiB
Rust
Executable File
41 lines
1.2 KiB
Rust
Executable File
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use utoipa::ToSchema;
|
|
|
|
/// DTO representing an item in the trash
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct TrashedItemDto {
|
|
pub id: String,
|
|
pub original_id: String,
|
|
pub item_type: String, // "file" o "folder"
|
|
pub name: String,
|
|
pub original_path: String,
|
|
pub trashed_at: DateTime<Utc>,
|
|
pub days_until_deletion: i64,
|
|
/// Human-readable category (e.g., "Image", "Folder", "Document")
|
|
pub category: String,
|
|
/// FontAwesome icon class for the file type
|
|
pub icon_class: String,
|
|
/// Special CSS class for icon styling (e.g., "image-icon", "pdf-icon")
|
|
pub icon_special_class: String,
|
|
}
|
|
|
|
/// Request to move an item to trash
|
|
#[derive(Debug, Deserialize, ToSchema)]
|
|
pub struct MoveToTrashRequest {
|
|
pub item_id: String,
|
|
pub item_type: String, // "file" o "folder"
|
|
}
|
|
|
|
/// Request to restore an item from trash
|
|
#[derive(Debug, Deserialize, ToSchema)]
|
|
pub struct RestoreFromTrashRequest {
|
|
pub trash_id: String,
|
|
}
|
|
|
|
/// Request to permanently delete an item from trash
|
|
#[derive(Debug, Deserialize, ToSchema)]
|
|
pub struct DeletePermanentlyRequest {
|
|
pub trash_id: String,
|
|
}
|