fix: wolves ID is numeric

This commit is contained in:
silver 2023-10-27 03:00:51 +01:00
parent d634806808
commit 2b86fa58e4
2 changed files with 6 additions and 6 deletions

View file

@ -99,7 +99,7 @@ async fn update_ldap(config: &Config, db: &Pool<Sqlite>) {
impl From<&WolvesResultUser> for AccountWolves { impl From<&WolvesResultUser> for AccountWolves {
fn from(input: &WolvesResultUser) -> Self { fn from(input: &WolvesResultUser) -> Self {
AccountWolves { AccountWolves {
id_wolves: input.wolves_id.to_owned(), id_wolves: input.wolves_id,
id_student: input.student_id.to_owned(), id_student: input.student_id.to_owned(),
email: input.email.to_owned(), email: input.email.to_owned(),
expiry: input.expiry.to_owned(), expiry: input.expiry.to_owned(),
@ -112,7 +112,7 @@ impl From<&WolvesResultUser> for AccountWolves {
#[derive(Deserialize, Serialize, Debug)] #[derive(Deserialize, Serialize, Debug)]
struct WolvesResultUser { struct WolvesResultUser {
committee: String, committee: String,
wolves_id: String, wolves_id: i64,
first_name: String, first_name: String,
last_name: String, last_name: String,
email: String, email: String,
@ -163,7 +163,7 @@ async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) {
VALUES (?1, ?2, ?3, ?4, ?5, ?6) VALUES (?1, ?2, ?3, ?4, ?5, ?6)
", ",
) )
.bind(&account.id_wolves) .bind(account.id_wolves)
.bind(&account.id_student) .bind(&account.id_student)
.bind(&account.email) .bind(&account.email)
.bind(&account.expiry) .bind(&account.expiry)

View file

@ -17,7 +17,7 @@ use tide::prelude::*;
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)] #[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
pub struct AccountWolves { pub struct AccountWolves {
pub id_wolves: String, pub id_wolves: i64,
pub id_student: Option<String>, pub id_student: Option<String>,
pub email: String, pub email: String,
pub expiry: String, pub expiry: String,
@ -69,7 +69,7 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
sqlx::query( sqlx::query(
"CREATE TABLE IF NOT EXISTS accounts_wolves ( "CREATE TABLE IF NOT EXISTS accounts_wolves (
id_wolves text PRIMARY KEY, id_wolves integer PRIMARY KEY,
id_student text, id_student text,
email text NOT NULL, email text NOT NULL,
expiry text NOT NULL, expiry text NOT NULL,
@ -87,7 +87,7 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
date_iso text NOT NULL, date_iso text NOT NULL,
date_expiry text NOT NULL, date_expiry text NOT NULL,
name_first text NOT NULL, name_first text NOT NULL,
name_surname integer NOT NULL, name_surname text NOT NULL,
id_student text NOT NULL id_student text NOT NULL
)", )",
) )