pi_dashboard.db.notes_database_manager

Notes database manager.

Classes

NoteEntryDB(*[, id])

Notes table.

NotesDatabaseManager(db_config)

Manager class for notes database operations.

class pi_dashboard.db.notes_database_manager.NoteEntryDB(*, id=None, title, content, time_created, time_updated)[source]

Notes table.

id: int | None
title: str
content: str
time_created: int
time_updated: int
classmethod from_note_entry(note_entry)[source]

Create a NoteEntryDB instance from a NoteEntry.

Return type:

NoteEntryDB

to_note_entry()[source]

Convert the database model to a NoteEntry.

Return type:

NoteEntry

update_from_note_entry(note_entry)[source]

Update the database model fields from a NoteEntry.

Return type:

None

__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.db.notes_database_manager.NotesDatabaseManager(db_config)[source]

Manager class for notes database operations.

__init__(db_config)[source]

Initialize the NotesDatabaseManager with the given database configuration.

db_config: DashboardDatabaseConfig
property db_url: str

Get the database URL.

get_all_note_entries()[source]

Public method to retrieve all note entries.

Return type:

list[NoteEntry]

perform_note_action(note_entry, action)[source]

Perform a note action (create/update/delete) on the database.

Return type:

int