feat: backend updated to have support for both teh current csv and future API

Also tweeked #21 a tad
This commit is contained in:
silver 2023-09-16 16:28:28 +01:00
parent e4e7171eac
commit 347988e113
5 changed files with 30 additions and 18 deletions

View file

@ -17,11 +17,12 @@ use tide::prelude::*;
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
pub struct AccountWolves {
pub id_wolves: String,
pub id_student: String,
pub id_member: String,
pub id_student: Option<String>,
pub email: String,
pub expiry: String,
pub name_first: String,
pub name_second: String,
pub name_first: Option<String>,
pub name_second: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, sqlx::FromRow)]
@ -70,12 +71,14 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
sqlx::query(
"CREATE TABLE IF NOT EXISTS accounts_wolves (
id_wolves text primary key,
id_student text not null,
id_wolves text DEFAULT '',
id_member text DEFAULT '',
id_student text,
email text not null,
expiry text not null,
name_first text not null,
name_second integer not null
name_first text,
name_second text,
PRIMARY KEY (id_wolves, id_member)
)",
)
.execute(&pool)