update image struct

This commit is contained in:
yuvlian
2026-02-21 11:26:26 +07:00
parent 0e70a0bb48
commit cac15def52
5 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
use super::common::{ use super::common::{
Ascension, Count, Desc, Element, Id, Level, Path, Rarity, StatType, StatValue, Uri, Ascension, Count, Desc, Element, Id, Level, Path, Rarity, StatType, StatValue, Image,
}; };
use super::item::ItemMini; use super::item::ItemMini;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@@ -9,7 +9,7 @@ use std::collections::{BTreeMap, HashMap};
pub struct Eidolon { pub struct Eidolon {
pub name: String, pub name: String,
pub desc: Desc, pub desc: Desc,
pub img_url: Uri, pub image: Image,
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -21,7 +21,7 @@ pub struct CharacterMini {
pub path: Path, pub path: Path,
pub rarity: Rarity, pub rarity: Rarity,
pub element: Element, pub element: Element,
pub img_url: Uri, pub image: Image,
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -33,7 +33,7 @@ pub struct CharacterFull {
pub path: Path, pub path: Path,
pub rarity: Rarity, pub rarity: Rarity,
pub element: Element, pub element: Element,
pub img_url: String, pub images: Vec<Image>,
pub max_hp: StatValue, pub max_hp: StatValue,
pub max_def: StatValue, pub max_def: StatValue,
pub max_atk: StatValue, pub max_atk: StatValue,

View File

@@ -4,7 +4,13 @@ pub type Id = i32;
pub type Level = i32; pub type Level = i32;
pub type Count = i32; pub type Count = i32;
pub type Desc = String; pub type Desc = String;
pub type Uri = String;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Image {
pub path: String,
pub filename: String,
pub author_info: Option<String>,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
pub enum StatValue { pub enum StatValue {

View File

@@ -1,4 +1,4 @@
use super::common::{Id, Uri}; use super::common::{Id, Image};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::BTreeMap; use std::collections::BTreeMap;
@@ -8,5 +8,5 @@ pub struct ItemSearch(pub BTreeMap<Id, ItemMini>);
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemMini { pub struct ItemMini {
pub name: String, pub name: String,
pub img_url: Uri, pub image: Image,
} }

View File

@@ -1,4 +1,4 @@
use super::common::{Count, Desc, Id, Level, Path, Rarity, StatValue, Uri}; use super::common::{Count, Desc, Id, Level, Path, Rarity, StatValue, Image};
use super::item::ItemMini; use super::item::ItemMini;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
@@ -11,7 +11,7 @@ pub struct LightconeMini {
pub name: String, pub name: String,
pub path: Path, pub path: Path,
pub rarity: Rarity, pub rarity: Rarity,
pub img_url: Uri, pub image: Image,
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -22,7 +22,7 @@ pub struct LightconeFull {
pub name: String, pub name: String,
pub path: Path, pub path: Path,
pub rarity: Rarity, pub rarity: Rarity,
pub img_url: Uri, pub images: Vec<Image>,
pub max_hp: StatValue, pub max_hp: StatValue,
pub max_def: StatValue, pub max_def: StatValue,
pub max_atk: StatValue, pub max_atk: StatValue,

View File

@@ -1,4 +1,4 @@
use super::common::{Desc, Id, RelicType, Uri}; use super::common::{Desc, Id, RelicType, Image};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
@@ -9,7 +9,7 @@ pub struct RelicSearch(pub BTreeMap<Id, RelicMini>);
pub struct RelicMini { pub struct RelicMini {
pub name: String, pub name: String,
pub r#type: RelicType, pub r#type: RelicType,
pub img_url: String, pub image: Image,
// lets just display these in the search page // lets just display these in the search page
pub two_pc: Desc, pub two_pc: Desc,
pub four_pc: Option<Desc>, pub four_pc: Option<Desc>,