mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 09:32:22 +03:00
5bbc72eb09
# Description - db for composite brains & repository - composite brains creation
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
from modules.brain.dto.inputs import CreateApiBrainDefinition
|
|
from modules.brain.entity.api_brain_definition_entity import ApiBrainDefinitionEntity
|
|
from modules.brain.repository.api_brain_definitions import ApiBrainDefinitions
|
|
from modules.brain.repository.interfaces import ApiBrainDefinitionsInterface
|
|
|
|
|
|
class ApiBrainDefinitionService:
|
|
repository: ApiBrainDefinitionsInterface
|
|
|
|
def __init__(self):
|
|
self.repository = ApiBrainDefinitions()
|
|
|
|
def add_api_brain_definition(
|
|
self, brain_id: UUID, api_brain_definition: CreateApiBrainDefinition
|
|
) -> None:
|
|
self.repository.add_api_brain_definition(brain_id, api_brain_definition)
|
|
|
|
def delete_api_brain_definition(self, brain_id: UUID) -> None:
|
|
self.repository.delete_api_brain_definition(brain_id)
|
|
|
|
def get_api_brain_definition(
|
|
self, brain_id: UUID
|
|
) -> Optional[ApiBrainDefinitionEntity]:
|
|
return self.repository.get_api_brain_definition(brain_id)
|
|
|
|
def update_api_brain_definition(
|
|
self, brain_id: UUID, api_brain_definition: ApiBrainDefinitionEntity
|
|
) -> Optional[ApiBrainDefinitionEntity]:
|
|
return self.repository.update_api_brain_definition(
|
|
brain_id, api_brain_definition
|
|
)
|