Skip to main content

systemprompt_files/models/
file.rs

1//! Persisted file row model.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use chrono::{DateTime, Utc};
7use serde::{Deserialize, Serialize};
8use sqlx::types::Json;
9use systemprompt_identifiers::{ContextId, FileId, SessionId, TraceId, UserId};
10
11use super::metadata::FileMetadata;
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct File {
15    pub id: FileId,
16    pub path: String,
17    pub public_url: String,
18    pub mime_type: String,
19    pub size_bytes: Option<i64>,
20    pub ai_content: bool,
21    pub metadata: Json<FileMetadata>,
22    pub user_id: Option<UserId>,
23    pub session_id: Option<SessionId>,
24    pub trace_id: Option<TraceId>,
25    pub context_id: Option<ContextId>,
26    pub created_at: DateTime<Utc>,
27    pub updated_at: DateTime<Utc>,
28    pub deleted_at: Option<DateTime<Utc>>,
29}