mirror of
https://github.com/MedzikUser/HomeDisk.git
synced 2024-08-14 21:46:53 +00:00
chore: cosmetic changes
This commit is contained in:
parent
bf10de2ca1
commit
4a9f8ec2e8
6 changed files with 12 additions and 15 deletions
|
@ -9,5 +9,7 @@
|
||||||
|
|
||||||
<a href="https://github.com/MedzikUser/HomeDisk"><img src="https://img.shields.io/github/workflow/status/MedzikUser/HomeDisk/Rust/main?style=flat-square"></a>
|
<a href="https://github.com/MedzikUser/HomeDisk"><img src="https://img.shields.io/github/workflow/status/MedzikUser/HomeDisk/Rust/main?style=flat-square"></a>
|
||||||
|
|
||||||
<a href="https://github.com/MedzikUser/HomeDisk"><img src="https://img.shields.io/badge/docs.rs-66c2a5?style=flat-square&labelColor=555555&logo=docs.rs"></a>
|
<a href="https://homedisk-doc.vercel.app"><img src="https://img.shields.io/badge/docs.rs-66c2a5?style=flat-square&labelColor=555555&logo=docs.rs"></a>
|
||||||
|
|
||||||
|
<a href="https://documenter.getpostman.com/view/23280189/VVk9dwRk"><img src="https://img.shields.io/badge/API_Docs-66c2a5?style=flat-square&labelColor=555555&logo=postman"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
/// Database Error
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("user not found")]
|
#[error("User not found")]
|
||||||
UserNotFound,
|
UserNotFound,
|
||||||
#[error("failed to open database: {0}")]
|
#[error("Failed to open database: {0}")]
|
||||||
OpenDatabase(sqlx::Error),
|
OpenDatabase(sqlx::Error),
|
||||||
#[error("failed to connect to the database: {0}")]
|
#[error("Failed to open connection with database: {0}")]
|
||||||
ConnectDatabase(sqlx::Error),
|
ConnectDatabase(sqlx::Error),
|
||||||
#[error("failed to get row: {0}")]
|
#[error("Failed to get row: {0}")]
|
||||||
GetRow(sqlx::Error),
|
GetRow(sqlx::Error),
|
||||||
#[error("failed to create all required tables: {0}")]
|
#[error("Failed to create all required tables: {0}")]
|
||||||
CreateTables(sqlx::Error),
|
CreateTables(sqlx::Error),
|
||||||
#[error("failed to execute the query: {0}")]
|
#[error("Failed to execute the query: {0}")]
|
||||||
Execute(sqlx::Error),
|
Execute(sqlx::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Custom Result alias for a [enum@Error].
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! [SQLite database functions](sqlite::Database).
|
//! [SQLite database functions](sqlite::Database)
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
mod sqlite;
|
mod sqlite;
|
||||||
|
|
|
@ -19,7 +19,6 @@ pub struct Database {
|
||||||
pub pool: SqlitePool,
|
pub pool: SqlitePool,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check UUID
|
|
||||||
impl Database {
|
impl Database {
|
||||||
/// Open a SQLite database
|
/// Open a SQLite database
|
||||||
pub async fn open(path: &str) -> Result<Self> {
|
pub async fn open(path: &str) -> Result<Self> {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// SQL user entry
|
/// SQL user entry
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
//! HomeDisk cloud server
|
//! HomeDisk cloud server
|
||||||
//!
|
//!
|
||||||
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
|
//! [Source code available on GitHub](https://github.com/MedzikUser/HomeDisk)
|
||||||
//!
|
|
||||||
//! [![github]](https://github.com/MedzikUser/HomeDisk)
|
|
||||||
//!
|
//!
|
||||||
//! ## Configure
|
//! ## Configure
|
||||||
//!
|
//!
|
||||||
|
|
Loading…
Reference in a new issue