mirror of
https://github.com/MedzikUser/HomeDisk.git
synced 2024-08-14 21:46:53 +00:00
chore: cleanup
This commit is contained in:
parent
b41ec426e6
commit
75f523f116
4 changed files with 13 additions and 14 deletions
|
@ -13,7 +13,7 @@ use super::{
|
|||
};
|
||||
|
||||
/// SQLite database
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Database {
|
||||
/// Sqlite connection pool
|
||||
pub pool: SqlitePool,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crypto_utils::sha::{Algorithm, CryptographicHash};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// SQL user entry
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize)]
|
||||
pub struct User {
|
||||
pub id: String,
|
||||
pub username: String,
|
||||
|
|
|
@ -2,9 +2,9 @@ use serde::Serialize;
|
|||
use thiserror::Error;
|
||||
use tracing::error;
|
||||
|
||||
#[derive(Debug, Clone, Error)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
// auth error
|
||||
// `/auth` error
|
||||
#[error("Too many request, please slow down.")]
|
||||
RateLimit,
|
||||
#[error("User not found")]
|
||||
|
@ -27,7 +27,8 @@ pub enum Error {
|
|||
MissingHeader(&'static str),
|
||||
#[error("`Authorization` header must be a bearer token")]
|
||||
MissingBearer,
|
||||
// fs error
|
||||
|
||||
// `/fs` error
|
||||
#[error("Invalid `path` query parameter")]
|
||||
InvalidPath,
|
||||
#[error("Failed to read files from directory")]
|
||||
|
@ -46,7 +47,7 @@ pub enum Error {
|
|||
DeleteFile,
|
||||
#[error("Multipart error")]
|
||||
Multipart,
|
||||
#[error("Write to file failed")]
|
||||
#[error("Failed write to file")]
|
||||
WriteFile,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
//! [Configuration file types](Config)
|
||||
|
||||
use std::fs;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Config {
|
||||
pub http: ConfigHTTP,
|
||||
pub jwt: ConfigJWT,
|
||||
pub storage: ConfigStorage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ConfigHTTP {
|
||||
pub host: String,
|
||||
|
@ -22,13 +20,13 @@ pub struct ConfigHTTP {
|
|||
pub tls_key: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ConfigJWT {
|
||||
pub secret: String,
|
||||
pub expires: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ConfigStorage {
|
||||
pub path: String,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue