Timezone and folder creation fixes
This commit is contained in:
@ -35,8 +35,8 @@ pub struct FileWithoutParentId {
|
||||
pub file_name: String,
|
||||
pub file_size: i64,
|
||||
pub sha512: String,
|
||||
pub created_at: chrono::NaiveDateTime,
|
||||
pub updated_at: chrono::NaiveDateTime,
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
pub updated_at: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
|
||||
pub fn get_files(
|
||||
|
@ -45,7 +45,7 @@ pub struct FolderWithoutParentId {
|
||||
pub folder_id: Uuid,
|
||||
pub owner_id: i32,
|
||||
pub folder_name: String,
|
||||
pub created_at: chrono::NaiveDateTime,
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
|
||||
pub async fn get_by_id(
|
||||
@ -87,17 +87,9 @@ pub async fn name_exists(parent_folder_id: Uuid, name: &str, pool: &Pool) -> sql
|
||||
.map(|row| row.exists.unwrap_or(false))
|
||||
}
|
||||
|
||||
pub async fn insert(
|
||||
parent_folder_id: Uuid,
|
||||
user_id: i32,
|
||||
folder_name: &str,
|
||||
pool: &Pool,
|
||||
) -> sqlx::Result<Uuid> {
|
||||
sqlx::query!("INSERT INTO folders(parent_folder_id, owner_id, folder_name) VALUES ($1, $2, $3) RETURNING folder_id",
|
||||
parent_folder_id,
|
||||
user_id,
|
||||
folder_name
|
||||
)
|
||||
/// Creates a folder in the database. Do not use this function to create the ROOT folder
|
||||
pub async fn insert(parent_folder_id: Uuid, folder_name: &str, pool: &Pool) -> sqlx::Result<Uuid> {
|
||||
sqlx::query_file!("sql/create_folder.sql", parent_folder_id, folder_name)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map(|record| record.folder_id)
|
||||
|
@ -23,14 +23,9 @@ pub async fn create(
|
||||
return Err(StatusCode::CONFLICT);
|
||||
}
|
||||
|
||||
let id = db::folder::insert(
|
||||
params.parent_folder_id,
|
||||
claims.user_id,
|
||||
¶ms.folder_name,
|
||||
&pool,
|
||||
)
|
||||
.await
|
||||
.handle_internal()?;
|
||||
let id = db::folder::insert(params.parent_folder_id, ¶ms.folder_name, &pool)
|
||||
.await
|
||||
.handle_internal()?;
|
||||
|
||||
Ok(Json(id))
|
||||
}
|
||||
|
@ -80,10 +80,8 @@ fn app(state: AppState) -> Router {
|
||||
};
|
||||
use tower_http::ServiceBuilderExt as _;
|
||||
|
||||
let sensitive_headers = [header::AUTHORIZATION, header::COOKIE];
|
||||
|
||||
let middleware = tower::ServiceBuilder::new()
|
||||
.sensitive_headers(sensitive_headers)
|
||||
.sensitive_headers([header::AUTHORIZATION, header::COOKIE])
|
||||
.trace_for_http()
|
||||
.compression();
|
||||
|
||||
|
Reference in New Issue
Block a user