show notification to vorstand if boat entry with 'externes boot' or on multiple days is entered
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
2024-04-15 22:03:20 +02:00
parent 8315a27ea8
commit 219b80377d
4 changed files with 69 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
use std::ops::DerefMut;
use serde::Serialize;
use sqlx::{FromRow, SqlitePool};
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
#[derive(FromRow, Serialize, Clone)]
pub struct Role {
@@ -45,6 +47,21 @@ WHERE name like ?
.ok()
}
pub async fn find_by_name_tx(db: &mut Transaction<'_, Sqlite>, name: &str) -> Option<Self> {
sqlx::query_as!(
Self,
"
SELECT id, name
FROM role
WHERE name like ?
",
name
)
.fetch_one(db.deref_mut())
.await
.ok()
}
pub async fn names_from_role(&self, db: &SqlitePool) -> Vec<String> {
let query = format!(
"SELECT u.name