Rename workspace

This commit is contained in:
Gregory Schier
2023-04-09 12:23:41 -07:00
parent 37f0eca79f
commit b82798bf49
20 changed files with 275 additions and 37 deletions

View File

@@ -423,6 +423,24 @@ pub async fn update_response_if_id(
return update_response(response, pool).await;
}
pub async fn update_workspace(
workspace: Workspace,
pool: &Pool<Sqlite>,
) -> Result<Workspace, sqlx::Error> {
sqlx::query!(
r#"
UPDATE workspaces SET (name, updated_at) =
(?, CURRENT_TIMESTAMP) WHERE id = ?;
"#,
workspace.name,
workspace.id,
)
.execute(pool)
.await
.expect("Failed to update workspace");
get_workspace(&workspace.id, pool).await
}
pub async fn update_response(
response: HttpResponse,
pool: &Pool<Sqlite>,