History

Module to hold the history repository

class HistoryRepository(manager, model=<class 'command_line_assistant.daemon.database.models.history.HistoryModel'>)[source]

Class that implements the history repository methods.

Default constructor for history repository.

Parameters:
  • manager (DatabaseManager) – The database manager instance.

  • model (HistoryModel) – The SQLAlchemy model to use in the repository.

delete_all(user_id)[source]

Method to remove all history from the database.

Return type:

None

Note

This method will actually call update internally to update the deleted_at field in the table.

Parameters:

user_id (Union[UUID, str]) – The unique identifier to query in the database.

select_all_history(user_id)[source]

Select all history entries by user id.

Return type:

list[HistoryModel]

Parameters:

user_id (Union[UUID, str]) – The user’s identifier

Returns:

The history entries

Return type:

list[HistoryModel]

select_by_chat_id(chat_id)[source]

Select a history entry by chat id.

Return type:

HistoryModel

Parameters:

chat_id (Union[UUID, str]) – The chat’s identifier

Returns:

The history entry

Return type:

HistoryModel

class InteractionRepository(manager, model=<class 'command_line_assistant.daemon.database.models.history.InteractionModel'>)[source]

Class that implements the interaction repository methods.

Default constructor for interaction repository.

Parameters:
  • manager (DatabaseManager) – The database manager instance.

  • model (InteractionModel) – The SQLAlchemy model to use in the repository.