deseasion.backend.services.project module
- class deseasion.backend.services.project.ProjectService
Bases:
object
- create_project_from_template(template_id, manager)
Create a new projet from a JSON template.
- Args:
template (std): The JSON template of the project. Will be modified. manager (User): The user that will be the manager of the project.
- create_template_from_project(project_id, user)
Create a template from a project.
- get_all_authorized_projects(user=None)
Return the list of all project viewable by the user.
The templates are not returned by this function.
Get all project data shares which the user has authorization for.
- Parameters:
project_id –
- Returns:
authorized data shares
- get_if_authorized(project_id, user=None)
Return the project if the user has the permissions to view it.
- Args:
project_id (int): Id of the project to return. user: User object.
- Raises:
PermissionError if the user is not authorized to view this project.
- get_if_manager(project_id, user)
Return the project if the user if the project’s manager.
- get_managed_templates(user)
Return the managed templates of the user.
- get_project_tasks(project_id, limit=None, offset=None)
Return the list of tasks started in the project.
- Args:
project_id (int): The id of the project. limit (int):
The number of tasks to return. Default: None (all the tasks).
- offset (int):
Offset for the tasks list. Default: None (start from the beginning).
- get_template_if_authorized(template_id, user=None)
- get_template_if_manager(template_id, user=None)
- get_total_project_tasks(project_id)
Return the total number of tasks in this project.
- get_user_templates(user=None)
Return the templates of the user.
- replace_input_attributes(project_id, attributes_mapping: dict[DataAttribute, DataAttribute]) Project
Replace input attributes of project data by new ones.
- Parameters:
project_id –
attributes_mapping – mapping of old attributes to new ones
- Raises:
ValueError –
if project data graph cycles would be introduced
if some attributes are not in any data of the project
if some new attributes introduced were already in the data inputs
TypeError – if an attribute has changed its type
- Returns:
modified project