1
0

Add dependencies to search (#578)

* Add dependencies to search

* add attrs for faceting

* run prepare

* Add user data route from token

* update to 24hrs

* Fix report bugs
This commit is contained in:
Geometrically
2023-04-20 16:38:30 -07:00
committed by GitHub
parent 5c559af936
commit 59f24df294
65 changed files with 1518 additions and 2218 deletions

View File

@@ -1,6 +1,4 @@
use crate::file_hosting::{
DeleteFileData, FileHost, FileHostingError, UploadFileData,
};
use crate::file_hosting::{DeleteFileData, FileHost, FileHostingError, UploadFileData};
use async_trait::async_trait;
use bytes::Bytes;
use chrono::Utc;
@@ -33,23 +31,12 @@ impl S3Host {
endpoint: url.to_string(),
}
},
Credentials::new(
Some(access_token),
Some(secret),
None,
None,
None,
)
.map_err(|_| {
FileHostingError::S3Error(
"Error while creating credentials".to_string(),
)
Credentials::new(Some(access_token), Some(secret), None, None, None).map_err(|_| {
FileHostingError::S3Error("Error while creating credentials".to_string())
})?,
)
.map_err(|_| {
FileHostingError::S3Error(
"Error while creating Bucket instance".to_string(),
)
FileHostingError::S3Error("Error while creating Bucket instance".to_string())
})?;
Ok(S3Host { bucket })
@@ -68,16 +55,10 @@ impl FileHost for S3Host {
let content_sha512 = format!("{:x}", sha2::Sha512::digest(&file_bytes));
self.bucket
.put_object_with_content_type(
format!("/{file_name}"),
&file_bytes,
content_type,
)
.put_object_with_content_type(format!("/{file_name}"), &file_bytes, content_type)
.await
.map_err(|_| {
FileHostingError::S3Error(
"Error while uploading file to S3".to_string(),
)
FileHostingError::S3Error("Error while uploading file to S3".to_string())
})?;
Ok(UploadFileData {
@@ -101,9 +82,7 @@ impl FileHost for S3Host {
.delete_object(format!("/{file_name}"))
.await
.map_err(|_| {
FileHostingError::S3Error(
"Error while deleting file from S3".to_string(),
)
FileHostingError::S3Error("Error while deleting file from S3".to_string())
})?;
Ok(DeleteFileData {