mdvtools.dbutils.dbservice#
Attributes#
Classes#
Module Contents#
- class mdvtools.dbutils.dbservice.ProjectService[source]#
- class mdvtools.dbutils.dbservice.FileService[source]#
- static add_or_update_file_in_project(file_name, file_path, project_id)[source]#
Adds a new file or updates an existing file in the database.
- static get_file_by_path_and_project(file_path, project_id)[source]#
Fetch a file by its path and project ID.
- class mdvtools.dbutils.dbservice.UserService[source]#
- static add_or_update_user(email: str, auth_id: str | None = None, first_name: str | None = None, last_name: str | None = None, institution: str | None = None)[source]#
Adds a new user or updates an existing user based on the provided email.
- Parameters:
email – User’s email address (mandatory).
auth_id – User’s Auth ID (optional).
first_name – User’s first name (optional).
last_name – User’s last name (optional).
institution – User’s institution or association (optional).
- Returns:
The created or updated User object.
- class mdvtools.dbutils.dbservice.UserProjectService[source]#
- static add_or_update_user_project(user_id: int, project_id: int, is_owner: bool = False, can_write: bool = False)[source]#
Adds a new user-project relationship or updates an existing one. Permission logic: - If is_owner is True, can_read and can_write are set to True. - If can_write is True (and is_owner is False), can_read is set to True. - If neither is_owner nor can_write is True, can_read is set to True.