-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
from base import BaseModel | ||
from sqlalchemy import BIGINT, VARCHAR, Numeric, ForeignKey | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
from sqlalchemy import VARCHAR, Numeric, ForeignKey | ||
from sqlalchemy.dialects.postgresql import UUID | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
|
||
from base import BaseModel | ||
|
||
|
||
class Order(BaseModel): | ||
""" | ||
Represents an order placed by a user. | ||
Attributes: | ||
- user_id (UUID): The unique identifier of the user who placed the order. | ||
Acts as both a primary key and a foreign key referencing the "user" table. | ||
- price (float): The price of the order, stored with a precision of up to 10 digits and 2 decimal places. | ||
- token (str): The token associated with the order. | ||
- position (UUID): The identifier of the position related to the order. | ||
Table: | ||
- Name: "order" | ||
""" | ||
__tablename__ = "order" | ||
user_id: Mapped[UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("user.id"), primary_key=True) | ||
price: Mapped[float] = mapped_column(Numeric(precision=10, scale=2)) | ||
token: Mapped[str] = mapped_column(VARCHAR) | ||
position: Mapped[UUID] = mapped_column(UUID(as_uuid=True)) | ||
|