You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
642 B
26 lines
642 B
use std::ops::Deref;
|
|
|
|
use actix_session::Session;
|
|
use actix_web::{HttpResponse, Responder};
|
|
|
|
pub(crate) mod models;
|
|
pub(crate) mod objects;
|
|
|
|
#[get("/")]
|
|
pub(crate) async fn index(
|
|
session: Session,
|
|
store: crate::YopaStoreWrapper,
|
|
) -> actix_web::Result<HttpResponse> {
|
|
objects::list_inner(session, store).await
|
|
}
|
|
|
|
#[get("/takeout")]
|
|
pub(crate) async fn takeout(store: crate::YopaStoreWrapper) -> actix_web::Result<impl Responder> {
|
|
let rg = store.read().await;
|
|
|
|
let encoded = serde_json::to_string_pretty(rg.deref()).unwrap();
|
|
|
|
Ok(HttpResponse::Ok()
|
|
.content_type("application/json")
|
|
.body(encoded))
|
|
}
|
|
|