code cleanup, starts testing

This commit is contained in:
2019-07-15 14:59:49 +02:00
parent 5d54d40bec
commit 58f39ae5d0
7 changed files with 158 additions and 111 deletions

View File

@@ -1,19 +1,32 @@
use crate::models::item::Loot;
use crate::schema::claims;
use diesel::prelude::*;
/// 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 {
id: i32,
player_id: i32,
loot_id: i32,
resolve: i32,
/// 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 struct NewClaim {
pub player_id: i32,
pub loot_id: i32,
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
}
}
}