-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdataset.rs
More file actions
65 lines (59 loc) · 1.65 KB
/
dataset.rs
File metadata and controls
65 lines (59 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct Dataset {
pub id: Uuid,
pub project_id: Option<Uuid>,
pub name: String,
pub description: Option<String>,
pub format: String,
pub s3_key: Option<String>,
pub size_bytes: Option<i64>,
pub row_count: Option<i64>,
pub version: i32,
pub created_by: Uuid,
pub snapshots: i32,
pub schema: Option<serde_json::Value>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize)]
pub struct CreateDatasetRequest {
pub project_id: Uuid,
pub name: String,
pub description: Option<String>,
pub format: String,
pub data: Option<String>, // base64-encoded file content
pub row_count: Option<i64>,
}
#[derive(Debug, Deserialize)]
pub struct UpdateDatasetRequest {
pub name: Option<String>,
pub description: Option<String>,
}
#[derive(Debug, Serialize)]
pub struct UploadUrlResponse {
pub upload_url: String,
pub s3_key: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct DataSource {
pub id: Uuid,
pub project_id: Option<Uuid>,
pub name: String,
pub source_type: String,
pub connection_string: Option<String>,
pub config: Option<serde_json::Value>,
pub created_by: Uuid,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize)]
pub struct CreateDataSourceRequest {
pub project_id: Uuid,
pub name: String,
pub source_type: String,
pub connection_string: Option<String>,
pub config: Option<serde_json::Value>,
}