DirectReport.models package

Subpackages

Submodules

DirectReport.models.daily_builder module

class DirectReport.models.daily_builder.DailyBuilder[source]

Bases: object

static add_new_daily()[source]

Adds a new daily ID.

Returns:

The newly created daily ID.

static get_daily_id()[source]

Retrieves the daily ID for the current day.

Returns:

The daily ID.

static list_all_daily_ids()[source]

Lists all daily IDs.

Returns:

A list of all daily IDs.

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:

Entry

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

mark_modified()[source]

Update the modified_on timestamp to the current time.

set_message(new_message)[source]

Update the message of the entry and set the modified_on timestamp to the current time.

Parameters:

new_message (str) – The new message/content for the entry.

to_dict()[source]

Convert the Entry object to a dictionary.

Returns:

The Entry object as a dictionary.

Return type:

dict

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.

static list_all()[source]

Lists all entries.

Returns:

A list of all entries.

static list_today()[source]

Lists all entries for today.

Returns:

A list of entries for today.

static new(entry_text, topic_text=None)[source]

Creates a new entry with the given entry text and topic.

Parameters:
  • entry_text – The entry text.

  • topic_text – The topic for the entry (optional).

static update(uid, entry_text, topic_text, created_at, weekly_id)[source]

Updates an entry with the given entry text and topic.

Parameters:
  • uid – The entry id.

  • entry_text – The entry text.

  • topic_text – The topic for the entry

  • created_at – The date entry was created.

  • weekly_id – The weekly id.

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 add_new_weekly()[source]

Adds a new weekly ID.

Returns:

The newly created weekly ID.

static get_weekly_id()[source]

Retrieves the weekly ID for the current week.

Returns:

The weekly ID.

static list_all_week_ids()[source]

Lists all weekly IDs.

Returns:

A list of all weekly IDs.

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.

static list_week(weekly_id)[source]

Lists all entries for a given week.

Parameters:

weekly_id – The weekly ID to list entries for.

Returns:

A list of entries for the specified week.

static week_exists()[source]

Check if there is a week UUID associated with the current date.

Returns:

True if a week UUID exists for the current date, False otherwise.

Return type:

bool

Module contents