init
This commit is contained in:
27
src/models/mod.rs
Normal file
27
src/models/mod.rs
Normal 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,
|
||||
}
|
Reference in New Issue
Block a user