app.model.base_model module

class app.model.base_model.BaseModel(*, id=<factory>, created_at=<factory>, updated_at=<factory>, apiKey_used=None, oauth_user_id=None)[source]

Bases: SQLModel

Base model class that provides ID, creation, and update timestamps.

Parameters:
  • id (str)

  • created_at (datetime)

  • updated_at (datetime)

  • apiKey_used (str | None)

  • oauth_user_id (str | None)

id

Unique identifier for each instance, automatically generated using UUID.

Type:

str

created_at

Timestamp recording when an instance is created, set to the current time by default.

Type:

datetime

updated_at

Timestamp recording the last update of an instance, set to the current time on creation and updates.

Type:

datetime

apiKey_used

The API key used for the instance.

Type:

str

oauth_user_id

The OAuth user ID associated with the instance.

Type:

str

__str__(self)[source]

Returns a string representation of the model instance.

__repr__(self)[source]

Returns an official string representation of the model.

__eq__(self, other)[source]

Determines equality based on ID, creation, and update timestamps.

__hash__(self)[source]

Provides a hash based on the ID, created_at, and updated_at attributes.

Configurations:
orm_mode (bool): Allows the model to be used with ORM, set to True to

enable.

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

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