feat: nixos side of the config #45
1 changed files with 10 additions and 7 deletions
|
@ -122,12 +122,12 @@ struct WolvesResultUser {
|
||||||
requested: String,
|
requested: String,
|
||||||
approved: String,
|
approved: String,
|
||||||
sitename: String,
|
sitename: String,
|
||||||
domain: String
|
domain: String,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
struct WolvesResult {
|
struct WolvesResult {
|
||||||
success: i8,
|
success: i8,
|
||||||
result: Vec<WolvesResultUser>
|
result: Vec<WolvesResultUser>,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
|
async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
|
||||||
|
@ -142,18 +142,21 @@ async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
|
||||||
let uri = &config.wolves_url;
|
let uri = &config.wolves_url;
|
||||||
let mut res = surf::post(uri).header("X-AM-Identity", &config.wolves_key).await.unwrap();
|
let mut res = surf::post(uri).header("X-AM-Identity", &config.wolves_key).await.unwrap();
|
||||||
|
|
||||||
if let Ok(WolvesResult { success, result }) = res.body_json().await {
|
if let Ok(WolvesResult {
|
||||||
|
success,
|
||||||
|
result,
|
||||||
|
}) = res.body_json().await
|
||||||
|
{
|
||||||
if success != 1 {
|
if success != 1 {
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.iter().map(|wolves| AccountWolves::from(wolves) ).collect::<Vec<AccountWolves>>();
|
return result.iter().map(AccountWolves::from).collect::<Vec<AccountWolves>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) {
|
async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) {
|
||||||
sqlx::query_as::<_, AccountWolves>(
|
sqlx::query_as::<_, AccountWolves>(
|
||||||
"
|
"
|
||||||
|
|
Loading…
Reference in a new issue