mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
f48dab4a7d
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
93 lines
2.1 KiB
Python
93 lines
2.1 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import List
|
|
from uuid import UUID
|
|
|
|
from modules.brain.entity.brain_entity import BrainUser, MinimalUserBrainEntity
|
|
|
|
|
|
class BrainsUsersInterface(ABC):
|
|
@abstractmethod
|
|
def get_user_brains(self, user_id) -> list[MinimalUserBrainEntity]:
|
|
"""
|
|
Create a brain in the brains table
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_brain_for_user(self, user_id, brain_id) -> MinimalUserBrainEntity | None:
|
|
"""
|
|
Get a brain for a user
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_brain_user_by_id(
|
|
self,
|
|
user_id: UUID,
|
|
brain_id: UUID,
|
|
):
|
|
"""
|
|
Delete a user in a brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_brain_users(self, brain_id: str):
|
|
"""
|
|
Delete all users for a brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def create_brain_user(self, user_id: UUID, brain_id, rights, default_brain: bool):
|
|
"""
|
|
Create a brain user
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_user_default_brain_id(self, user_id: UUID) -> UUID | None:
|
|
"""
|
|
Get the default brain id for a user
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_brain_users(self, brain_id: UUID) -> List[BrainUser]:
|
|
"""
|
|
Get all users for a brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_brain_subscribers(self, brain_id: UUID):
|
|
"""
|
|
Delete all subscribers for a brain with Viewer rights
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_brain_subscribers_count(self, brain_id: UUID) -> int:
|
|
"""
|
|
Get the number of subscribers for a brain
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_brain_user_default_status(
|
|
self, user_id: UUID, brain_id: UUID, default_brain: bool
|
|
):
|
|
"""
|
|
Update the default brain status for a user
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_brain_user_rights(
|
|
self, brain_id: UUID, user_id: UUID, rights: str
|
|
) -> BrainUser:
|
|
"""
|
|
Update the rights for a user in a brain
|
|
"""
|
|
pass
|