Error fixes

type mismatch in update user and some styling improvements
This commit is contained in:
2026-05-28 18:49:29 +02:00
parent 04b9ef8f9e
commit 6ef50d06aa
4 changed files with 22 additions and 24 deletions

View File

@@ -268,7 +268,7 @@ pub async fn get_current_user(
/// - `404 Not Found` if user doesn't exist
/// - `500 Internal Server Error` if database error occurs
pub async fn delete_user(
Path(id): Path<i32>,
Path(id): Path<i16>,
State(data): State<Arc<AppState>>,
) -> Result<impl IntoResponse, (StatusCode, Json<serde_json::Value>)> {
let query = sqlx::query(r#"DELETE FROM users WHERE id = $1"#)
@@ -411,7 +411,7 @@ pub async fn get_user_by_id(
/// - This endpoint requires admin privileges (enforced by middleware via
/// [`validate_admin`](crate::cookie::validation::validate_admin)).
pub async fn update_user(
Path(id): Path<i32>,
Path(id): Path<i16>,
State(data): State<Arc<AppState>>,
Json(body): Json<UserUpdateScheme>,
) -> Result<impl IntoResponse, (StatusCode, Json<serde_json::Value>)> {

View File

@@ -302,7 +302,7 @@ pub fn submit_ticket_component() -> Html {
<option value="Whiteboard Beamer">{ "Whiteboard Beamer" }</option>
<option value="Internet">{ "Internet" }</option>
<option value="iPad Koffer">{ "iPad Koffer" }</option>
<option value="Apple TV">{ "Apple TV" }</option>
<option value="Apple TV" selected=true>{ "Apple TV" }</option>
<option value="Docu Cam">{ "Dokumenten Kamera" }</option>
<option value="Sonstiges">{ "Sonstiges" }</option>
</select>

View File

@@ -771,10 +771,10 @@ pub fn user_by_id_component(props: &UserProps) -> Html {
<button type="submit" disabled={*saving}>{ if *saving { "Speichern..." } else { "Speichern" } }</button>
if *save_success {
<p style="color:green">{ "Erfolgreich aktualisiert" }</p>
<p class="alert success">{ "Erfolgreich aktualisiert" }</p>
}
if let Some(err) = &*save_error {
<p style="color:red">{ err.clone() }</p>
<p class="alert error">{ err.clone() }</p>
}
</form>
@@ -784,7 +784,7 @@ pub fn user_by_id_component(props: &UserProps) -> Html {
<Link<crate::Route> to={crate::Route::AllUsers} classes="return-to">{ "Zurück zur Benutzerübersicht" }</Link<crate::Route>>
if let Some(err) = &*delete_error {
<p style="color:red">{ err.clone() }</p>
<p class="alert error">{ err.clone() }</p>
}
</div>
}

View File

@@ -285,7 +285,8 @@ pub fn ticket_count_component() -> Html {
.send()
.await
&& response.status() == 200
&& let Ok(json) = response.json::<serde_json::Value>().await {
&& let Ok(json) = response.json::<serde_json::Value>().await
{
let id = json
.get("data")
.and_then(|d| d.get("id"))
@@ -311,10 +312,7 @@ pub fn ticket_count_component() -> Html {
let status_conditions = |t: &Ticket| t.status == "ToDo" || t.status == "InProgress";
let count = tickets
.iter()
.filter(|t| {
status_conditions(t)
&& (user.is_admin || (user.id == Some(t.user_id)))
})
.filter(|t| status_conditions(t) && (user.is_admin || (user.id == Some(t.user_id))))
.count();
html! {
<div class="open-tickets">
@@ -435,7 +433,7 @@ pub fn submit_stats_component() -> Html {
<p>{ "Lade..." }</p>
}
if let Some(e) = &*error {
<p style="color: red;">{ e.clone() }</p>
<p class="alert error">{ e.clone() }</p>
}
<h3>{ "Tickets pro Wochentag" }</h3>
<div class="weekday-chart">