Skip to content

Commit

Permalink
fix: add missing code field in ProductBase
Browse files Browse the repository at this point in the history
and add documentation
  • Loading branch information
raphael0202 committed Nov 23, 2023
1 parent e60dc0a commit 4e647b4
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ class ProductCreate(BaseModel):

class ProductBase(BaseModel):
id: int
source: Flavor | None
product_name: str | None
product_quantity: int | None
image_url: AnyHttpUrl | None
created: datetime.datetime
updated: datetime.datetime | None
code: str = Field(
min_length=1,
pattern="^[0-9]+$",
description="barcode (EAN) of the product, as a string.",
)
source: Flavor | None = Field(
description="source of data, either `off` (Open Food Facts), "
"`obf` (Open Beauty Facts), `opff` (Open Pet Food Facts) or `obf` (Open Beauty Facts)"
)
product_name: str | None = Field(description="name of the product.")
product_quantity: int | None = Field(
description="quantity of the product, normalized in g or mL (depending on the product)."
)
image_url: AnyHttpUrl | None = Field(description="URL of the product image.")
created: datetime.datetime = Field(description="datetime of the creation.")
updated: datetime.datetime | None = Field(
description="datetime of the last update."
)


class LocationCreate(BaseModel):
Expand Down

0 comments on commit 4e647b4

Please sign in to comment.