login endpoint is real!!

This commit is contained in:
Reid 2023-08-27 21:39:54 -07:00
parent f3908219cd
commit 77ad597963
Signed by: reidlab
GPG key ID: 6C9EAA3364F962C8
6 changed files with 81 additions and 8 deletions

17
src/helpers/accounts.rs Normal file
View file

@ -0,0 +1,17 @@
use diesel::prelude::*;
use crate::db;
pub fn get_user_id_from_account_id(ext_id: i32) -> i32 {
use crate::schema::users::dsl::*;
let connection = &mut db::establish_connection_pg();
let user_id = users
.filter(udid.eq(ext_id.to_string()).or(account_id.eq(ext_id)))
.select(id)
.get_result::<i32>(connection)
.expect("No user associated with account?!?!?");
user_id
}