From c38d45e1623ef3a4c1b57035672ae993d09232d5 Mon Sep 17 00:00:00 2001 From: Jake Probst Date: Wed, 28 Aug 2019 21:39:57 -0700 Subject: [PATCH] base mock data --- src/login/main.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/login/main.rs b/src/login/main.rs index ab9ba31..ae3d738 100644 --- a/src/login/main.rs +++ b/src/login/main.rs @@ -15,20 +15,50 @@ use mio::tcp::TcpListener; use mio::{Events, Poll, Token, Ready, PollOpt}; //use dotenv::dotenv; +use bcrypt; //use diesel::r2d2; //use diesel::prelude::*; //use diesel::pg::PgConnection; +use libpso::character::settings; + //use models::{NewUser, UserAccount, UserSettings, NewUserSettings}; //use dataaccess::DBAccess; +use entities::{UserAccount, UserSettings}; use dataaccess::DataAccess; +use std::time::SystemTime; + #[derive(Clone)] struct LoginStubData { } impl DataAccess for LoginStubData { + fn get_user_by_name(&self, username: String) -> Option { + if username.as_str() == "hi" { + Some(UserAccount { + id: 1, + username: "hi".to_owned(), + password: bcrypt::hash("qwer", 5).unwrap(), + guildcard: None, + team_id: None, + banned: false, + muted_until: SystemTime::now(), + created_at: SystemTime::now(), + }) + } + else { + None + } + } + fn get_user_settings_by_user(&self, user: &UserAccount) -> Option { + Some(UserSettings { + id: 0, + user_id: user.id, + settings: settings::UserSettings::default() + }) + } } fn main() {