hgame 0.26.4

CG production management structs, e.g. of assets, personnels, progress, etc.
Documentation
use super::*;

// -------------------------------------------------------------------------------
#[async_trait]
/// Responsible for modifications of [`Staff`].
pub trait StaffGov: DynClone + fmt::Debug + Send + Sync {
    async fn add_one(&self, project: &Project, user: &Staff) -> Result<(), ModificationError>;

    async fn add_many(&self, project: &Project, users: &[Staff]) -> Result<(), ModificationError>;

    async fn edit_one(&self, project: &Project, user: &Staff) -> Result<(), ModificationError>;

    async fn edit_many(&self, project: &Project, users: &[Staff]) -> Result<(), ModificationError>;

    async fn delete_one(&self, project: &Project, user: &Staff) -> Result<(), ModificationError>;

    async fn delete_many(
        &self,
        project: &Project,
        staffs: &[Staff],
    ) -> Result<(), ModificationError>;
}

dyn_clone::clone_trait_object!(StaffGov);

// -------------------------------------------------------------------------------
#[async_trait]
/// Responsible for building staff subtrees based on roles.
pub trait StaffOrg: DynClone + fmt::Debug + Send + Sync {
    /// Given an active [`Project`] and a staff name, gets one corresponding staff whose role is known.
    async fn staff_from_name(
        &mut self,
        project: &Project,
        user_name: &str,
    ) -> Result<Staff, DatabaseError>;

    /// Given a staff name, filters for the projects in which the staff is a member of.
    async fn member_in_panproject(
        &mut self,
        projects: &[Project],
        user_name: &str,
    ) -> Result<Vec<Project>, DatabaseError>;

    /// Gets the whole "staff layout" -- all staffs organized by roles.
    async fn staves(&self, project: &Project) -> Result<RoleMap, DatabaseError>;

    #[cfg(feature = "gui")]
    async fn staff_tree(&self, project: &Project) -> Result<Vec<MkTree<Staff>>, DatabaseError>;

    #[cfg(feature = "gui")]
    async fn staff_treecb(&self, project: &Project) -> Result<Vec<MkTreeCb<Staff>>, DatabaseError>;

    fn clear_cache(&mut self) {}
}

dyn_clone::clone_trait_object!(StaffOrg);