uses tips from diesel.rs guide for application integration

This commit is contained in:
2019-06-22 21:55:21 +02:00
parent 99404543b3
commit 5379ad236f
5 changed files with 69 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
use actix_web::{web, web::Json, Error, HttpResponse, Result};
use futures::Future;
use lootalot_db::{Pool, DbConnection, QueryResult, ActionResult};
use lootalot_db::{RunQueryDsl, Pool, DbConnection, QueryResult, ActionResult};
use lootalot_db::{Item, Player};
/// A wrapper providing an API over the database
@@ -49,7 +49,7 @@ pub struct AsPlayer<'q> {
impl<'q> AsPlayer<'q> {
/// Fetch the content of a player's chest
pub fn loot(self) -> QueryResult<Vec<Item>> {
Player::fetch_loot(self.id, self.conn)
dbg!( Ok( Item::owned_by(self.id).load(self.conn)? ) )
}
/// Put a claim on a specific item
pub fn claim(self, item: i32) -> ActionResult {