|
|
@ -77,6 +77,7 @@ impl File {
|
|
|
|
storage_id: i64,
|
|
|
|
storage_id: i64,
|
|
|
|
hash: S,
|
|
|
|
hash: S,
|
|
|
|
file_type: FileType,
|
|
|
|
file_type: FileType,
|
|
|
|
|
|
|
|
mime_type: Option<String>,
|
|
|
|
) -> RepoResult<Self> {
|
|
|
|
) -> RepoResult<Self> {
|
|
|
|
let hash = hash::ActiveModel {
|
|
|
|
let hash = hash::ActiveModel {
|
|
|
|
value: Set(hash.to_string()),
|
|
|
|
value: Set(hash.to_string()),
|
|
|
@ -88,6 +89,7 @@ impl File {
|
|
|
|
let file = file::ActiveModel {
|
|
|
|
let file = file::ActiveModel {
|
|
|
|
hash_id: Set(id),
|
|
|
|
hash_id: Set(id),
|
|
|
|
file_type: Set(file_type as u32),
|
|
|
|
file_type: Set(file_type as u32),
|
|
|
|
|
|
|
|
mime_type: Set(mime_type),
|
|
|
|
storage_id: Set(storage_id),
|
|
|
|
storage_id: Set(storage_id),
|
|
|
|
import_time: Set(now.clone()),
|
|
|
|
import_time: Set(now.clone()),
|
|
|
|
creation_time: Set(now.clone()),
|
|
|
|
creation_time: Set(now.clone()),
|
|
|
@ -122,6 +124,11 @@ impl File {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns the optional mime type of the file
|
|
|
|
|
|
|
|
pub fn mime_type(&self) -> &Option<String> {
|
|
|
|
|
|
|
|
&self.model.mime_type
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns the optional name of the file
|
|
|
|
/// Returns the optional name of the file
|
|
|
|
pub fn name(&self) -> &Option<String> {
|
|
|
|
pub fn name(&self) -> &Option<String> {
|
|
|
|
&self.model.name
|
|
|
|
&self.model.name
|
|
|
|