be able to update data individually; Fixes #951
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m36s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2025-04-30 11:06:10 +02:00
parent 90087843ad
commit c8d5c633d7
8 changed files with 589 additions and 221 deletions

View File

@@ -1,4 +1,4 @@
use std::ops::DerefMut;
use std::{fmt::Display, ops::DerefMut};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
@@ -10,6 +10,12 @@ pub struct Role {
pub(crate) cluster: Option<String>,
}
impl Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.name)
}
}
impl Role {
pub async fn all(db: &SqlitePool) -> Vec<Role> {
sqlx::query_as!(Role, "SELECT id, name, cluster FROM role")