simplify resourcetype

This commit is contained in:
Lennart
2024-11-04 20:46:16 +01:00
parent ab9c5f6b38
commit 2143bc850c
13 changed files with 98 additions and 72 deletions

View File

@@ -5,17 +5,10 @@ use actix_web::dev::ResourceMap;
use actix_web::HttpRequest;
use async_trait::async_trait;
use rustical_store::auth::User;
use serde::{Deserialize, Serialize};
use std::any::type_name;
use std::marker::PhantomData;
use strum::{EnumString, VariantNames};
#[derive(Deserialize, Serialize, Default, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct Resourcetype {
collection: (),
}
#[derive(Clone)]
pub struct RootResource<PR: Resource>(PhantomData<PR>);
@@ -31,11 +24,14 @@ pub enum RootResourcePropName {}
impl<PR: Resource> Resource for RootResource<PR> {
type PropName = RootResourcePropName;
type Prop = CommonPropertiesProp<Self::ResourceType>;
type Prop = CommonPropertiesProp;
type Error = PR::Error;
type ResourceType = Resourcetype;
type PrincipalResource = PR;
fn get_resourcetype() -> &'static [&'static str] {
&["collection"]
}
fn get_prop(
&self,
_rmap: &ResourceMap,