settings: add base url, WIP flash system
This commit is contained in:
parent
f2bea92272
commit
c670201b86
18 changed files with 190 additions and 68 deletions
|
|
@ -3,6 +3,7 @@ use crate::Settings;
|
|||
use database::sqlx::SqliteExecutor;
|
||||
use database::Settings as DatabaseSettings;
|
||||
use id::UserID;
|
||||
use url::Url;
|
||||
|
||||
const DEFAULT_BUSINESS_NAME: &str = "ezidam";
|
||||
pub const DEFAULT_BUSINESS_LOGO: &[u8] = include_bytes!("../../../logo/ezidam.png");
|
||||
|
|
@ -18,6 +19,7 @@ impl From<DatabaseSettings> for Settings {
|
|||
business_logo: db
|
||||
.business_logo
|
||||
.unwrap_or_else(|| DEFAULT_BUSINESS_LOGO.to_vec()),
|
||||
url: db.url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,4 +57,10 @@ impl Settings {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn set_url(conn: impl SqliteExecutor<'_>, url: &Url) -> Result<(), Error> {
|
||||
DatabaseSettings::set_url(conn, url.as_str()).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ pub struct Settings {
|
|||
updated_at: DateTime<Utc>,
|
||||
business_name: String,
|
||||
business_logo: Vec<u8>,
|
||||
url: Option<String>,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue