summaryrefslogtreecommitdiff
path: root/src/database/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/mod.rs')
-rw-r--r--src/database/mod.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/database/mod.rs b/src/database/mod.rs
index 884a597..ab30884 100644
--- a/src/database/mod.rs
+++ b/src/database/mod.rs
@@ -7,9 +7,11 @@ pub mod user;
use serde::{Deserialize, Serialize};
use sqlx::mysql::{MySqlPool, MySqlPoolOptions};
use std::env;
+use utoipa::ToSchema;
-#[derive(Serialize, Deserialize)]
+#[derive(Serialize, Deserialize, ToSchema)]
pub struct Delete {
+ #[schema(example = "1", required = true)]
pub id: Option<String>,
}
@@ -21,11 +23,7 @@ impl DatabaseWrapper {
pub async fn new() -> Result<DatabaseWrapper, sqlx::Error> {
let pool: MySqlPool = MySqlPoolOptions::new()
.max_connections(10)
- .connect(
- env::var("DATABASE_URL")
- .expect("Environment variable DATABASE_URL is *probably not setted up!!")
- .as_str(),
- )
+ .connect(env!("DATABASE_URL"))
.await
.unwrap(); /* This will break in case of error. It's intended. */