From cac15def529a774355dc68f67cf261ddd098f6b1 Mon Sep 17 00:00:00 2001 From: yuvlian <51725554+yuvlian@users.noreply.github.com> Date: Sat, 21 Feb 2026 11:26:26 +0700 Subject: [PATCH] update image struct --- resource_api/src/types/character.rs | 8 ++++---- resource_api/src/types/common.rs | 8 +++++++- resource_api/src/types/item.rs | 4 ++-- resource_api/src/types/lightcone.rs | 6 +++--- resource_api/src/types/relic.rs | 4 ++-- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/resource_api/src/types/character.rs b/resource_api/src/types/character.rs index 8219fe8..c002397 100644 --- a/resource_api/src/types/character.rs +++ b/resource_api/src/types/character.rs @@ -1,5 +1,5 @@ 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 serde::{Deserialize, Serialize}; @@ -9,7 +9,7 @@ use std::collections::{BTreeMap, HashMap}; pub struct Eidolon { pub name: String, pub desc: Desc, - pub img_url: Uri, + pub image: Image, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -21,7 +21,7 @@ pub struct CharacterMini { pub path: Path, pub rarity: Rarity, pub element: Element, - pub img_url: Uri, + pub image: Image, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,7 +33,7 @@ pub struct CharacterFull { pub path: Path, pub rarity: Rarity, pub element: Element, - pub img_url: String, + pub images: Vec, pub max_hp: StatValue, pub max_def: StatValue, pub max_atk: StatValue, diff --git a/resource_api/src/types/common.rs b/resource_api/src/types/common.rs index b1b0290..6e0c03b 100644 --- a/resource_api/src/types/common.rs +++ b/resource_api/src/types/common.rs @@ -4,7 +4,13 @@ pub type Id = i32; pub type Level = i32; pub type Count = i32; 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, +} #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] pub enum StatValue { diff --git a/resource_api/src/types/item.rs b/resource_api/src/types/item.rs index 0a3412a..2f71922 100644 --- a/resource_api/src/types/item.rs +++ b/resource_api/src/types/item.rs @@ -1,4 +1,4 @@ -use super::common::{Id, Uri}; +use super::common::{Id, Image}; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; @@ -8,5 +8,5 @@ pub struct ItemSearch(pub BTreeMap); #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ItemMini { pub name: String, - pub img_url: Uri, + pub image: Image, } diff --git a/resource_api/src/types/lightcone.rs b/resource_api/src/types/lightcone.rs index 375a09b..5dab1a0 100644 --- a/resource_api/src/types/lightcone.rs +++ b/resource_api/src/types/lightcone.rs @@ -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 serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; @@ -11,7 +11,7 @@ pub struct LightconeMini { pub name: String, pub path: Path, pub rarity: Rarity, - pub img_url: Uri, + pub image: Image, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -22,7 +22,7 @@ pub struct LightconeFull { pub name: String, pub path: Path, pub rarity: Rarity, - pub img_url: Uri, + pub images: Vec, pub max_hp: StatValue, pub max_def: StatValue, pub max_atk: StatValue, diff --git a/resource_api/src/types/relic.rs b/resource_api/src/types/relic.rs index 0e36654..b6abb92 100644 --- a/resource_api/src/types/relic.rs +++ b/resource_api/src/types/relic.rs @@ -1,4 +1,4 @@ -use super::common::{Desc, Id, RelicType, Uri}; +use super::common::{Desc, Id, RelicType, Image}; use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; @@ -9,7 +9,7 @@ pub struct RelicSearch(pub BTreeMap); pub struct RelicMini { pub name: String, pub r#type: RelicType, - pub img_url: String, + pub image: Image, // lets just display these in the search page pub two_pc: Desc, pub four_pc: Option,