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
| Attribute | Type | Description |
|---|---|---|
| id | uuid.UUID = uuid.uuid4 | Unique identifier for the item, automatically generated as a UUID to serve as the primary key. |
| created_at | `datetime | None` = get_datetime_utc |
| owner_id | uuid.UUID | The unique identifier of the user who owns this item, acting as a foreign key with cascade deletion. |
| owner | `User | None` |
Constructor
Signature
def Item(
**data: Any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| **data | Any | Keyword 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
| Name | Type | Description |
|---|---|---|
| id | uuid.UUID = uuid.uuid4() | The unique identifier for the item record |
| created_at | `datetime | None` = get_datetime_utc() |
| owner_id | uuid.UUID = null | The unique identifier of the user who owns this item, used for database foreign key constraints |
| owner | `User | None` = null |