adds docs, removes some useless pub statements
This commit is contained in:
@@ -19,6 +19,7 @@ pub struct Claim {
|
||||
}
|
||||
|
||||
impl Claim {
|
||||
/// Resolves this claim (player wins the item) and deletes it
|
||||
pub fn resolve_claim(&self, conn: &DbConnection) -> QueryResult<()> {
|
||||
let loot: Loot = Loot::find(self.loot_id).first(conn)?;
|
||||
loot.set_owner(self.player_id, conn)?;
|
||||
@@ -35,6 +36,7 @@ impl Claim {
|
||||
pub struct Claims<'q>(pub &'q DbConnection);
|
||||
|
||||
impl<'q> Claims<'q> {
|
||||
/// Get all claims from database
|
||||
pub fn all(&self) -> QueryResult<Vec<Claim>> {
|
||||
claims::table.load(self.0)
|
||||
}
|
||||
@@ -47,7 +49,11 @@ impl<'q> Claims<'q> {
|
||||
.first(self.0)
|
||||
}
|
||||
|
||||
/// Adds a claim in database and returns it
|
||||
/// Adds a claim in database and returns it.
|
||||
///
|
||||
/// Will validate that the claimed item exists and is
|
||||
/// actually owned by the group.
|
||||
/// Duplicates are also ignored.
|
||||
pub fn add(self, player_id: i32, loot_id: i32) -> QueryResult<Claim> {
|
||||
// We need to validate that the claimed item exists
|
||||
// AND is actually owned by group (id 0)
|
||||
|
||||
Reference in New Issue
Block a user