30 lines
742 B
Rust
30 lines
742 B
Rust
use crate::models::item::Loot;
|
|
use crate::schema::claims;
|
|
|
|
/// A Claim is a request by a single player on an item from group chest.
|
|
#[derive(Identifiable, Queryable, Associations, Serialize, Debug)]
|
|
#[belongs_to(Loot)]
|
|
pub struct Claim {
|
|
/// DB Identifier
|
|
pub id: i32,
|
|
/// ID that references the player making this claim
|
|
pub player_id: i32,
|
|
/// ID that references the loot claimed
|
|
pub loot_id: i32,
|
|
/// WIP: How bad the player wants this item
|
|
pub resolve: i32,
|
|
}
|
|
|
|
#[derive(Insertable, Debug)]
|
|
#[table_name = "claims"]
|
|
pub(crate) struct NewClaim {
|
|
player_id: i32,
|
|
loot_id: i32,
|
|
}
|
|
|
|
impl NewClaim {
|
|
pub(crate) fn new(player_id: i32, loot_id: i32) -> Self {
|
|
Self { player_id, loot_id }
|
|
}
|
|
}
|