linkrs_server/web/models/
metadata.rs1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
8pub struct HistoryItem {
9 pub id: String,
10 pub session_id: String,
11 pub query: String,
12 #[schema(value_type = String)]
13 pub executed_at: DateTime<Utc>,
14 pub execution_time_ms: i64,
15 pub rows_returned: i64,
16 pub success: bool,
17 pub error_message: Option<String>,
18}
19
20#[derive(Debug, Deserialize, utoipa::ToSchema)]
22pub struct AddHistoryRequest {
23 pub query: String,
24 pub execution_time_ms: i64,
25 pub rows_returned: i64,
26 pub success: bool,
27 pub error_message: Option<String>,
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
32pub struct FavoriteItem {
33 pub id: String,
34 pub session_id: String,
35 pub name: String,
36 pub query: String,
37 pub description: Option<String>,
38 #[schema(value_type = String)]
39 pub created_at: DateTime<Utc>,
40}
41
42#[derive(Debug, Deserialize, utoipa::ToSchema)]
44pub struct AddFavoriteRequest {
45 pub name: String,
46 pub query: String,
47 pub description: Option<String>,
48}
49
50#[derive(Debug, Deserialize, utoipa::ToSchema)]
52pub struct UpdateFavoriteRequest {
53 pub name: Option<String>,
54 pub query: Option<String>,
55 pub description: Option<String>,
56}
57
58#[derive(Debug, Serialize, utoipa::ToSchema)]
60pub struct FavoriteListResponse {
61 pub items: Vec<FavoriteItem>,
62}
63
64#[derive(Debug, Serialize, utoipa::ToSchema)]
66pub struct HistoryListResponse {
67 pub items: Vec<HistoryItem>,
68 pub total: i64,
69}