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,5 +1,4 @@
use crate::schema::{items, looted};
use crate::DbConnection;
use crate::schema::{looted};
use diesel::dsl::{exists, Eq, Filter, Find, Select};
use diesel::expression::exists::Exists;
use diesel::prelude::*;
@@ -60,7 +59,7 @@ type ItemDesc<'a> = (&'a str, i32);
/// to the id of buying player otherwise.
#[derive(Insertable)]
#[table_name = "looted"]
struct NewLoot<'a> {
pub(crate) struct NewLoot<'a> {
name: &'a str,
base_price: i32,
owner_id: i32,
@@ -68,7 +67,7 @@ struct NewLoot<'a> {
impl<'a> NewLoot<'a> {
/// A new loot going to the group (loot procedure)
fn to_group(desc: ItemDesc<'a>) -> Self {
pub(crate) fn to_group(desc: ItemDesc<'a>) -> Self {
Self {
name: desc.0,
base_price: desc.1,
@@ -77,7 +76,7 @@ impl<'a> NewLoot<'a> {
}
/// A new loot going to a specific player (buy procedure)
fn to_player(player: i32, desc: ItemDesc<'a>) -> Self {
pub(crate) fn to_player(player: i32, desc: ItemDesc<'a>) -> Self {
Self {
name: desc.0,
base_price: desc.1,