fix(client >> session >> data): made a deserializable enum for permissions instead of using strings

This commit is contained in:
antifallobst 2024-03-31 17:06:21 +02:00
parent 104683381c
commit 1906d66026
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
1 changed files with 11 additions and 6 deletions

View File

@ -1,25 +1,30 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub enum Permission {
GenerateInviteTokens,
PromoteUsers,
}
pub mod api { pub mod api {
use super::Deserialize; use super::*;
pub mod account { pub mod account {
use super::Deserialize; use super::*;
pub mod info { pub mod info {
use super::Deserialize; use super::*;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Response { pub struct Response {
pub userid: String, pub userid: String,
// TODO: make permissions an enum pub permissions: Vec<Permission>,
pub permissions: Vec<String>,
} }
} }
} }
pub mod error { pub mod error {
use super::Deserialize; use super::*;
#[derive(Debug, thiserror::Error, Deserialize)] #[derive(Debug, thiserror::Error, Deserialize)]
pub enum Error { pub enum Error {