aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/waifus.rs
blob: 117ba1505fe25759fbadc7b65832f8e3e41df1c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use axum::{response::IntoResponse, Json};

use tracing::{error, instrument};

use waifulib::house::House;
use waifulib::waifu::Waifu;

use crate::errors::*;

pub async fn list() -> JsonResult<Json<Vec<Waifu>>> {
    let con_url = std::env::var("QEMU_URL").unwrap_or("qemu:///system".to_string());
    let mut house: House = House::new(con_url)?;
    
    let inhabitants = house.inhabitants()?;

    Ok(Json(inhabitants))
}