Compware/src/models/item.rs

20 lines
593 B
Rust
Raw Normal View History

/// Represents an Item in CompareWare.
/// Each item has metadata and key-value tags for categorization.
2024-12-06 14:45:14 +03:00
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
2024-12-06 14:45:14 +03:00
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Item {
pub id: String,
pub name: String,
pub description: String,
// pub reviews: Vec<ReviewWithRating>,
pub wikidata_id: Option<String>,
pub custom_properties: HashMap<String, String>,
2024-12-17 13:39:41 +03:00
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ReviewWithRating {
pub content: String,
pub rating: u8, // Ratings from 1 to 5
}