This commit is contained in:
2025-07-20 13:38:44 +02:00
commit a58df1cb8e
35 changed files with 4108 additions and 0 deletions

27
src/models/mod.rs Normal file
View File

@@ -0,0 +1,27 @@
use mongodb::bson::{doc, oid::ObjectId};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct OriginOrLocation {
pub name: String,
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Character {
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id: Option<ObjectId>, // Mongo _id
pub rmid: i32, // Rick&Morty ID, don't confuse with _id
pub name: String,
pub status: String,
pub species: String,
pub r#type: String,
pub gender: String,
pub origin: OriginOrLocation,
pub location: OriginOrLocation,
pub image: String,
pub episode: Vec<String>,
pub url: String,
pub created: String,
pub elo_rating: f64,
}