verification_service

Attributes

logger

Logger for the verification service module

Classes

VerificationService

A service class for managing verifications-related operations such as retrieving, adding,

Module Contents

logger

Logger for the verification service module

class VerificationService

A service class for managing verifications-related operations such as retrieving, adding, deleting, skipping, and updating verification records. It also manages check queue items for verification checks.

static get_user_verifications(user_id: int) list[tuple[datetime.datetime.time, str, bool]]

Retrieve the verifications for a user.

Parameters:

user_id (int) – The ID of the user whose verifications are being retrieved.

Returns:

A list of tuples containing the time, description, and active status for each verification.

Return type:

list[tuple[datetime.time, str, bool]]

static get_idle_users_verifications() list[tuple[int, datetime.datetime.time, str, bool]]

Retrieves a list of verifications from users who have not responded.

Returns:

A list of tuples, each containing:
  • user ID (int)

  • time of the message (datetime.time)

  • description of the message (str)

  • whether the message is active (bool)

Return type:

list[tuple[int, datetime.time, str, bool]]

static add_verifications(user_id: int, new_verifications: list, skip_check: bool = False) list[str]

Add new verifications for a user.

Parameters:
  • user_id (int) – The ID of the user for whom verifications are being added.

  • new_verifications (list) – A list of new verification entries to add.

  • skip_check (bool) – Whether to skip validation checks for existing verifications.

Returns:

A list of times for which verifications were not valid.

Return type:

list[str]

static delete_verifications(user_id: int, times_to_delete: list) None

Delete specific verifications for a user.

Parameters:
  • user_id (int) – The ID of the user from whom verifications will be deleted.

  • times_to_delete (list) – A list of times specifying which verifications to delete.

static skip_verifications(user_id: int, times_to_skip: list) None

Mark specific verifications as skipped (inactive).

Parameters:
  • user_id (int) – The ID of the user whose verifications are being skipped.

  • times_to_skip (list) – A list of times specifying which verifications to skip.

static undoskip_verifications(user_id: int, times_to_undoskip: list) None

Revert the status of specific verifications to active.

Parameters:
  • user_id (int) – The ID of the user whose verifications are being reverted.

  • times_to_undoskip (list) – A list of times specifying which verifications to reactivate.

static get_check_queue_items() list[tuple[int, datetime.datetime.time, str, int, int]]

Retrieves all checks from the check queue.

Returns:

A list of tuples, each containing:
  • user ID (int)

  • time of the check (datetime.time)

  • description of the check (str)

  • reminder count (int)

  • waiting time (int)

Return type:

list[tuple[int, datetime.time, str, int, int]]

static update_check_queue_property(user_id: int, key: str, value: int) None

Updates a specific property of a user’s check queue entry.

Parameters:
  • user_id (int) – The ID of the user.

  • key (str) – The name of the field to be updated.

  • value (int) – The new value to be set for the specified field.

static add_check_queue_item(user_id: int, time: datetime.datetime.time, desc: str, waiting_time: int) None

Initializes a check queue entry for a user.

Parameters:
  • user_id (int) – The ID of the user.

  • time (datetime.time) – The time associated with the check.

  • desc (str) – The description of the check.

  • waiting_time (int) – The waiting time before the next reminder.

static delete_check_queue_item(user_id: int) None

Deletes a user’s check queue entry.

Parameters:

user_id (int) – The ID of the user whose check queue entry should be deleted.

static update_verification_status(user_id: int, times_to_update: list, active: bool) None

Update the status of specific verifications for a user.

Parameters:
  • user_id (int) – The ID of the user whose verification statuses are being updated.

  • times_to_update (list) – A list of times specifying which verifications to update.

  • active (bool) – The new status for the verifications (active or inactive).