-
-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding the rest ofthe nutrition properties from schema.org
- Loading branch information
Showing
9 changed files
with
114 additions
and
22 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
alembic/versions/2024-10-01-14.17.00_602927e1013e_add_the_rest_of_the_schema_org_.py
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""'add the rest of the schema.org nutrition properties' | ||
Revision ID: 602927e1013e | ||
Revises: 1fe4bd37ccc8 | ||
Create Date: 2024-10-01 14:17:00.611398 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "602927e1013e" | ||
down_revision: str | None = "1fe4bd37ccc8" | ||
branch_labels: str | tuple[str, ...] | None = None | ||
depends_on: str | tuple[str, ...] | None = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("recipe_nutrition", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("cholesterol_content", sa.String(), nullable=True)) | ||
batch_op.add_column(sa.Column("saturated_fat_content", sa.String(), nullable=True)) | ||
batch_op.add_column(sa.Column("trans_fat_content", sa.String(), nullable=True)) | ||
batch_op.add_column(sa.Column("unsaturated_fat_content", sa.String(), nullable=True)) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("recipe_nutrition", schema=None) as batch_op: | ||
batch_op.drop_column("unsaturated_fat_content") | ||
batch_op.drop_column("trans_fat_content") | ||
batch_op.drop_column("saturated_fat_content") | ||
batch_op.drop_column("cholesterol_content") | ||
|
||
# ### end Alembic commands ### |
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
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
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
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
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
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
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,14 +1,24 @@ | ||
from pydantic import ConfigDict | ||
from pydantic.alias_generators import to_camel | ||
|
||
from mealie.schema._mealie import MealieModel | ||
|
||
|
||
class Nutrition(MealieModel): | ||
calories: str | None = None | ||
fat_content: str | None = None | ||
protein_content: str | None = None | ||
carbohydrate_content: str | None = None | ||
cholesterol_content: str | None = None | ||
fat_content: str | None = None | ||
fiber_content: str | None = None | ||
protein_content: str | None = None | ||
saturated_fat_content: str | None = None | ||
sodium_content: str | None = None | ||
sugar_content: str | None = None | ||
model_config = ConfigDict(from_attributes=True, coerce_numbers_to_str=True) | ||
trans_fat_content: str | None = None | ||
unsaturated_fat_content: str | None = None | ||
|
||
model_config = ConfigDict( | ||
from_attributes=True, | ||
coerce_numbers_to_str=True, | ||
alias_generator=to_camel, | ||
) |
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