common.utils

Common utility functions.

into_seconds_from_now(seconds: int) int[source]

Convert seconds from now to Unix timestamp.

inject_ids_into_records(body: Dict | Any) Dict[str, Any][source]

Ensures every record in ‘data’ has an ‘_id’ field. If missing, a UUID is assigned.

Parameters:

body – A Pydantic model containing a ‘data’ key with a list of records.

Returns:

A dictionary version of the body with ‘_id’ injected where missing.