nicer explanations
Some checks failed
CI/CD Pipeline / test (push) Failing after 6m20s
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2024-12-11 19:22:29 +01:00
parent a5a5b1ec25
commit 64ca9826ea
8 changed files with 153 additions and 75 deletions

View File

@@ -250,12 +250,20 @@ ORDER BY last_access DESC
.unwrap()
}
pub async fn create(db: &SqlitePool, name: &str) -> bool {
pub async fn create(db: &SqlitePool, name: &str) {
let name = name.trim();
sqlx::query!("INSERT INTO USER(name) VALUES (?)", name)
if sqlx::query!("INSERT INTO USER(name) VALUES (?)", name)
.execute(db)
.await
.is_ok()
{
return;
}
sqlx::query!("UPDATE user SET deleted = false where name = ?", name)
.execute(db)
.await
.unwrap();
}
pub async fn update(&self, db: &SqlitePool, data: UserEditForm) -> Result<(), String> {