Geoffrey-rs/geoffrey_models/src/models/item.rs

37 lines
810 B
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq)]
pub struct Item {
pub name: String,
}
impl Item {
pub fn new(name: &str) -> Self {
Self {
name: name.to_string(),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq)]
pub struct ItemListing {
pub item: Item,
pub price: u32,
pub count_per_price: u32,
pub restocked_time: DateTime<Utc>,
}
impl ItemListing {
fn new(item: &str, price: u32, count_per_price: u32, restocked_time: DateTime<Utc>) -> Self {
Self {
item: Item {
name: item.to_string(),
},
price,
count_per_price,
restocked_time,
}
}
}