forked from Ruderverein-Donau-Linz/rowt
in preparation to moving userdata into app, we switched to arbitrary groups
This commit is contained in:
17
src/model/role.rs
Normal file
17
src/model/role.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use serde::Serialize;
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
|
||||
#[derive(FromRow, Serialize, Clone)]
|
||||
pub struct Role {
|
||||
id: i64,
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl Role {
|
||||
pub async fn all(db: &SqlitePool) -> Vec<Role> {
|
||||
sqlx::query_as!(Role, "SELECT id, name FROM role")
|
||||
.fetch_all(db)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user