potree-auth 0.1.0

Authentication and project management for `potree` point clouds.
Documentation
use super::super::application::error::RenderingServiceError;
use crate::common::utils::http::render_error::RenderError;

impl From<RenderingServiceError> for RenderError {
    fn from(value: RenderingServiceError) -> Self {
        match value {
            RenderingServiceError::ProjectNotFound { id } => Self::ResourceNotFound {
                resource_name: format!("project: {id}"),
            },
            RenderingServiceError::NotAuthorized {
                user,
                action,
                resource_identifier,
                resource_type,
            } => Self::NotAuthorized {
                user,
                action,
                resource_identifier,
                resource_type,
            },
            RenderingServiceError::NotAuthenticated => Self::NotAuthenticated,
            RenderingServiceError::ServerConfiguration { message } => {
                Self::ServerConfiguration { message }
            }
            RenderingServiceError::Infrastucture { message } => Self::Infrastucture { message },
        }
    }
}

impl From<askama::Error> for RenderError {
    fn from(value: askama::Error) -> Self {
        Self::ServerError {
            message: format!("error rendering template: {value}"),
        }
    }
}