fix: got release builds actually working

This commit is contained in:
Andrew Rioux
2025-02-17 01:36:01 -05:00
parent 118d56fc36
commit d823603054
16 changed files with 244 additions and 211 deletions
+8 -8
View File
@@ -58,7 +58,7 @@ pub struct PubUser {
last_active: Option<DateTime<Utc>>,
}
#[server]
#[server(prefix = "/api/users", endpoint = "delete")]
async fn delete_user(user_id: i64) -> Result<(), ServerFnError> {
let user = user::get_auth_session().await?;
@@ -68,7 +68,7 @@ async fn delete_user(user_id: i64) -> Result<(), ServerFnError> {
));
}
let pool = expect_context::<SqlitePool>();
let pool = crate::db::get_db()?;
sqlx::query!("DELETE FROM users WHERE user_id = ?", user_id)
.execute(&pool)
@@ -77,7 +77,7 @@ async fn delete_user(user_id: i64) -> Result<(), ServerFnError> {
Ok(())
}
#[server]
#[server(prefix = "/api/users", endpoint = "reset")]
async fn reset_password(user_id: i64, password: String) -> Result<(), ServerFnError> {
let user = user::get_auth_session().await?;
@@ -87,7 +87,7 @@ async fn reset_password(user_id: i64, password: String) -> Result<(), ServerFnEr
));
}
let pool = expect_context::<SqlitePool>();
let pool = crate::db::get_db()?;
crate::db::user::reset_password(&pool, user_id as i16, password).await?;
@@ -226,7 +226,7 @@ pub fn RenderUser(refresh_user_list: Action<(), ()>, user: PubUser) -> impl Into
}
}
#[server]
#[server(prefix = "/api/users", endpoint = "list")]
async fn list_users() -> Result<Vec<PubUser>, ServerFnError> {
let user = user::get_auth_session().await?;
@@ -238,7 +238,7 @@ async fn list_users() -> Result<Vec<PubUser>, ServerFnError> {
use futures::stream::StreamExt;
let pool = expect_context::<SqlitePool>();
let pool = crate::db::get_db()?;
let users = sqlx::query_as!(DbUser, "SELECT user_id, user_name, last_active FROM users")
.fetch(&pool)
@@ -260,7 +260,7 @@ async fn list_users() -> Result<Vec<PubUser>, ServerFnError> {
Ok(users?)
}
#[server]
#[server(prefix = "/api/users", endpoint = "add")]
async fn add_user(name: String, password: String) -> Result<(), ServerFnError> {
let user = user::get_auth_session().await?;
@@ -270,7 +270,7 @@ async fn add_user(name: String, password: String) -> Result<(), ServerFnError> {
));
}
let pool = expect_context::<SqlitePool>();
let pool = crate::db::get_db()?;
crate::db::user::create_user(&pool, name, password).await?;