FileRepository module

class repositories.file_repository.FileRepository(db_name: str = 'concord.db')

Bases: repositories.repository_interface.RepositoryInterface

A class that manipulates the file table

delete_by_id(file_id: str)bool

Deletes all Files containing the file_id”

Parameters

file_id – the file’s unique identification code

Returns

A tuple containing containing the list of files and whether the operation was successful or not

find_all_by_id(file_id: str)Tuple[List[dtos.dto_file.File], bool]

Finds all Files containing the file_id”

Parameters

file_id – the file’s unique identification code

Returns

A tuple containing containing the list of files and whether the operation was successful or not

find_by_id(words_id: str)Tuple[dtos.dto_file.File, bool]

Finds one File containing the file_id”

Parameters

words_id – the file’s unique identification code

Returns

A tuple containing containing file and whether the operation was successful or not

put(file: dtos.dto_file.File)bool

Puts all Files containing the file_id”

Parameters

file – the file to be stored on the database

Returns

A boolean representing whether the operation was successful or not

update_by_id(file_id: str, new_data: dtos.dto_file.File)bool

Updates all Files containing the file_id”

Parameters
  • file_id – the file’s unique identification code

  • new_data – the file’s new data

Returns

A tuple containing containing the list of files and whether the operation was successful or not