DirectReport.models package
Subpackages
Submodules
DirectReport.models.daily_builder module
DirectReport.models.entry module
- class DirectReport.models.entry.Entry(uuid, topic, message, created_at, modified_on, week_uuid)[source]
Bases:
object
A class to represent a journal entry.
- classmethod from_dict(data)[source]
Create an Entry object from a dictionary.
- Parameters:
data (dict) – The dictionary containing the Entry data.
- Returns:
An Entry object.
- Return type:
- get_created_at_formatted(format='%Y-%m-%d %H:%M:%S')[source]
Get the created_at timestamp formatted as a string.
- Parameters:
format (str) – The desired format of the timestamp, default is “%Y-%m-%d %H:%M:%S”.
- Returns:
The formatted created_at timestamp.
- Return type:
str
- get_modified_on_formatted(format='%Y-%m-%d %H:%M:%S')[source]
Get the modified_on timestamp formatted as a string.
- Parameters:
format (str) – The desired format of the timestamp, default is “%Y-%m-%d %H:%M:%S”.
- Returns:
The formatted modified_on timestamp.
- Return type:
str
- is_recent(days=7)[source]
Check if the entry is recent (created within the specified number of days).
- Parameters:
days (int) – The number of days to consider as recent, default is 7.
- Returns:
True if the entry is recent, False otherwise.
- Return type:
bool
DirectReport.models.list_builder module
- class DirectReport.models.list_builder.ListBuilder[source]
Bases:
object
A class to facilitate creating, deleting and listing entries in a weekly and daily report system.
- static delete(entry_id)[source]
Deletes an entry with the specified ID.
- Parameters:
entry_id – The ID of the entry to delete.
DirectReport.models.weekly_builder module
- class DirectReport.models.weekly_builder.WeeklyBuilder[source]
Bases:
object
A class to facilitate creating, deleting and listing entries in a weekly and daily report system.
- static get_weekly_id()[source]
Retrieves the weekly ID for the current week.
- Returns:
The weekly ID.
- static list_this_week_as_json()[source]
Lists all entries for the current week as JSON.
- Returns:
A JSON representation of all entries for the current week.