incorrect /all type

This commit is contained in:
41666 2023-05-30 19:04:24 -04:00
parent 28abf2362d
commit 65849ab8bd
2 changed files with 4 additions and 10 deletions

View file

@ -1,6 +1,6 @@
use crate::{ use crate::{
sources::{fisu, honu, saerro, sanctuary, voidwell}, sources::{fisu, honu, saerro, sanctuary, voidwell},
types::{AllResponse, Population, Response}, types::{Population, Response},
}; };
use axum::{ use axum::{
extract::{Path, State}, extract::{Path, State},
@ -12,7 +12,7 @@ pub async fn get_one_world(State(db): State<sled::Db>, Path(world): Path<i32>) -
Json(get_world(db, world).await) Json(get_world(db, world).await)
} }
pub async fn get_all_worlds(State(db): State<sled::Db>) -> Json<AllResponse> { pub async fn get_all_worlds(State(db): State<sled::Db>) -> Json<Vec<Response>> {
let mut set = JoinSet::new(); let mut set = JoinSet::new();
let mut worlds = vec![Response::default(); 8]; let mut worlds = vec![Response::default(); 8];
@ -26,7 +26,7 @@ pub async fn get_all_worlds(State(db): State<sled::Db>) -> Json<AllResponse> {
i += 1; i += 1;
} }
Json(AllResponse { worlds }) Json(worlds)
} }
async fn get_world(db: sled::Db, world: i32) -> Response { async fn get_world(db: sled::Db, world: i32) -> Response {

View file

@ -1,12 +1,6 @@
use std::collections::HashMap;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct AllResponse {
pub worlds: Vec<Response>,
}
#[derive(Deserialize, Serialize, Debug, Clone, Default)] #[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct Response { pub struct Response {