taskbridgeapp.notes.controller.NoteController

class taskbridgeapp.notes.controller.NoteController

Bases: object

Contains various static methods for the stages of note synchronisation.

Methods

associate_folders

Associate local/remote folders.

get_local_folders

Get the list of local notes folders.

get_remote_folders

Get the list of remote note folders.

sync_deleted_notes

Synchronise notes deleted locally/remotely.

sync_folder_deletions

Synchronise deleted local/remote notes folders.

sync_notes

Synchronise notes.

Attributes

ASSOCIATIONS

Dictionary of associations

LOCAL_NOTE_FOLDERS

List of local note folders

REMOTE_NOTE_FOLDER

Path to the remote notes folder

REMOTE_NOTE_FOLDERS

List of remote note folders

ASSOCIATIONS: dict = {}

Dictionary of associations

LOCAL_NOTE_FOLDERS: List[LocalNoteFolder] = []

List of local note folders

REMOTE_NOTE_FOLDER: Path = None

Path to the remote notes folder

REMOTE_NOTE_FOLDERS: List[RemoteNoteFolder] = []

List of remote note folders

__init__()
static associate_folders()

Associate local/remote folders.

Return type:

tuple[bool, str] | tuple[bool, List[NoteFolder]]

Returns:

-success (bool) - true if the folders are successfully associated.

-data (str | List[NoteFolder]) - error message on failure, or list of associations on success.

static get_local_folders()

Get the list of local notes folders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if the folders are successfully retrieved.

-data (str) - error message on failure, or success message.

static get_remote_folders()

Get the list of remote note folders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if the folders are successfully retrieved.

-data (str) - error message on failure, or success message.

static sync_deleted_notes()

Synchronise notes deleted locally/remotely.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if note deletions are successfully synchronised.

-data (str) - error message on failure, or success message.

static sync_folder_deletions()

Synchronise deleted local/remote notes folders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if the folders deletions are successfully synchronised.

-data (str) - error message on failure, or success message.

static sync_notes()

Synchronise notes. Returns a dictionary with the following keys:

  • remote_added - name of notes added to the remote folder as List[str].

  • remote_updated - name of notes updated in the remote folder as List[str].

  • local_added - name of notes added to the local folder as List[str].

  • local_updated - name of notes updated in the local folder as List[str].

Any of the above may be empty if no such changes were made.

Return type:

tuple[bool, str] | tuple[bool, dict]

Returns:

-success (bool) - true if notes are successfully synchronised.

-data (str | dict) - error message on failure, or dict with results as above.