forked from Ruderverein-Donau-Linz/rowt
enable changing paid state
This commit is contained in:
@@ -3,8 +3,8 @@ use sqlx::{FromRow, SqlitePool};
|
||||
|
||||
#[derive(FromRow, Serialize, Clone)]
|
||||
pub struct Role {
|
||||
id: i64,
|
||||
name: String,
|
||||
pub(crate) id: i64,
|
||||
pub(crate) name: String,
|
||||
}
|
||||
|
||||
impl Role {
|
||||
@@ -30,6 +30,21 @@ WHERE id like ?
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub async fn find_by_name(db: &SqlitePool, name: &str) -> Option<Self> {
|
||||
sqlx::query_as!(
|
||||
Self,
|
||||
"
|
||||
SELECT id, name
|
||||
FROM role
|
||||
WHERE name like ?
|
||||
",
|
||||
name
|
||||
)
|
||||
.fetch_one(db)
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub async fn mails_from_role(&self, db: &SqlitePool) -> Vec<String> {
|
||||
let query = format!(
|
||||
"SELECT u.mail
|
||||
|
Reference in New Issue
Block a user