remote postgres dep and fix save_user function
This commit is contained in:
parent
0db9a73849
commit
19e30f34e6
@ -30,7 +30,6 @@ ages-prs = "0.1"
|
||||
async-trait = "0.1.31"
|
||||
lazy_static = "1.4.0"
|
||||
barrel = { version = "0.6.5", features = ["pg"] }
|
||||
postgres = "0.17.5"
|
||||
refinery = { version = "0.3.0", features = ["postgres"] }
|
||||
sqlx = { version = "0.4.0-beta.1", features = ["postgres", "json", "chrono"] }
|
||||
|
||||
|
@ -13,9 +13,6 @@ use crate::ship::map::MapArea;
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::Row;
|
||||
use sqlx::Execute;
|
||||
use postgres::{Client, NoTls};
|
||||
|
||||
|
||||
#[derive(Debug, sqlx::FromRow)]
|
||||
pub struct PgUserAccount {
|
||||
id: i32,
|
||||
|
@ -14,9 +14,6 @@ use crate::entity::item::*;
|
||||
use super::models::*;
|
||||
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::Row;
|
||||
use sqlx::Execute;
|
||||
use postgres::{Client, NoTls};
|
||||
|
||||
mod embedded {
|
||||
use refinery::embed_migrations;
|
||||
@ -123,14 +120,14 @@ impl EntityGateway for PostgresGateway {
|
||||
}
|
||||
|
||||
async fn save_user(&mut self, user: &UserAccountEntity) -> Result<(), GatewayError> {
|
||||
sqlx::query("UPDATE user_accounts set name=$1, password=$2, banned=$3, muted=$4, flags=$5 where id=$6")
|
||||
sqlx::query("UPDATE user_accounts set username=$1, password=$2, banned=$3, muted=$4, flags=$5 where id=$6")
|
||||
.bind(&user.username)
|
||||
.bind(&user.password)
|
||||
.bind(&user.banned_until)
|
||||
.bind(&user.muted_until)
|
||||
.bind(&user.flags)
|
||||
.bind(&user.id.0)
|
||||
.fetch_one(&self.pool).await?;
|
||||
.execute(&self.pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user