Skip to main content

Item

This class represents a database entity for an item, extending the ItemBase model with persistent storage configurations. It defines a unique identifier, a creation timestamp with timezone support, and a mandatory relationship to a user who owns the item. The class utilizes foreign key constraints and cascading deletes to maintain data integrity within the database schema.

Attributes

AttributeTypeDescription
iduuid.UUID = uuid.uuid4Unique identifier for the item, automatically generated as a UUID to serve as the primary key.
created_at`datetimeNone` = get_datetime_utc
owner_iduuid.UUIDThe unique identifier of the user who owns this item, acting as a foreign key with cascade deletion.
owner`UserNone`

Constructor

Signature

def Item(
**data: Any
) - > null

Parameters

NameTypeDescription
**dataAnyKeyword arguments used to initialize the model fields.

Signature

def Item(
id: uuid.UUID = uuid.uuid4(),
created_at: datetime | None = get_datetime_utc(),
owner_id: uuid.UUID = null,
owner: User | None = null
) - > null

Parameters

NameTypeDescription
iduuid.UUID = uuid.uuid4()The unique identifier for the item record
created_at`datetimeNone` = get_datetime_utc()
owner_iduuid.UUID = nullThe unique identifier of the user who owns this item, used for database foreign key constraints
owner`UserNone` = null