settings: get first admin

This commit is contained in:
Philippe Loctaux 2023-05-03 21:47:00 +02:00
parent 0baeeadce9
commit 4bfc8a517f
4 changed files with 8 additions and 1 deletions

View file

@ -3,7 +3,8 @@ select id,
updated_at as "updated_at: DateTime<Utc>",
business_name,
business_logo,
url
url,
first_admin
from settings

View file

@ -11,6 +11,7 @@ pub struct Settings {
pub business_name: Option<String>,
pub business_logo: Option<Vec<u8>>,
pub url: Option<String>,
pub first_admin: Option<String>,
}
impl Settings {

View file

@ -20,6 +20,7 @@ impl From<DatabaseSettings> for Settings {
.business_logo
.unwrap_or_else(|| DEFAULT_BUSINESS_LOGO.to_vec()),
url: db.url,
first_admin: db.first_admin,
}
}
}

View file

@ -14,6 +14,7 @@ pub struct Settings {
business_name: String,
business_logo: Vec<u8>,
url: Option<String>,
first_admin: Option<String>,
}
impl Settings {
@ -32,4 +33,7 @@ impl Settings {
pub fn updated_at(&self) -> DateTime<Utc> {
self.updated_at
}
pub fn first_admin(&self) -> Option<&str> {
self.first_admin.as_deref()
}
}