mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-16 04:43:13 -05:00
chore: refactor base schema (#1098)
* remove dead backup code * implmenet own base model * refactor to use MealieModel instead of CamelModel * cleanup deps
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
from .group_preferences import UpdateGroupPreferences
|
||||
|
||||
|
||||
class GroupAdminUpdate(CamelModel):
|
||||
class GroupAdminUpdate(MealieModel):
|
||||
id: UUID4
|
||||
name: str
|
||||
preferences: UpdateGroupPreferences
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4, NoneStr
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
# =============================================================================
|
||||
# Group Events Notifier Options
|
||||
|
||||
|
||||
class GroupEventNotifierOptions(CamelModel):
|
||||
class GroupEventNotifierOptions(MealieModel):
|
||||
"""
|
||||
These events are in-sync with the EventTypes found in the EventBusService.
|
||||
If you modify this, make sure to update the EventBusService as well.
|
||||
@@ -55,7 +56,7 @@ class GroupEventNotifierOptionsOut(GroupEventNotifierOptions):
|
||||
# Notifiers
|
||||
|
||||
|
||||
class GroupEventNotifierCreate(CamelModel):
|
||||
class GroupEventNotifierCreate(MealieModel):
|
||||
name: str
|
||||
apprise_url: str
|
||||
|
||||
@@ -71,7 +72,7 @@ class GroupEventNotifierUpdate(GroupEventNotifierSave):
|
||||
apprise_url: NoneStr = None
|
||||
|
||||
|
||||
class GroupEventNotifierOut(CamelModel):
|
||||
class GroupEventNotifierOut(MealieModel):
|
||||
id: UUID4
|
||||
name: str
|
||||
enabled: bool
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
class GroupDataExport(CamelModel):
|
||||
|
||||
class GroupDataExport(MealieModel):
|
||||
id: UUID4
|
||||
group_id: UUID4
|
||||
name: str
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import enum
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
|
||||
class SupportedMigrations(str, enum.Enum):
|
||||
@@ -10,5 +10,5 @@ class SupportedMigrations(str, enum.Enum):
|
||||
mealie_alpha = "mealie_alpha"
|
||||
|
||||
|
||||
class DataMigrationCreate(CamelModel):
|
||||
class DataMigrationCreate(MealieModel):
|
||||
source_type: SupportedMigrations
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
class SetPermissions(CamelModel):
|
||||
|
||||
class SetPermissions(MealieModel):
|
||||
user_id: UUID4
|
||||
can_manage: bool = False
|
||||
can_invite: bool = False
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
class UpdateGroupPreferences(CamelModel):
|
||||
|
||||
class UpdateGroupPreferences(MealieModel):
|
||||
private_group: bool = False
|
||||
first_day_of_week: int = 0
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
from mealie.schema.recipe.recipe_ingredient import IngredientFood, IngredientUnit
|
||||
|
||||
|
||||
class ShoppingListItemRecipeRef(CamelModel):
|
||||
class ShoppingListItemRecipeRef(MealieModel):
|
||||
recipe_id: UUID4
|
||||
recipe_quantity: float
|
||||
|
||||
@@ -21,7 +21,7 @@ class ShoppingListItemRecipeRefOut(ShoppingListItemRecipeRef):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class ShoppingListItemCreate(CamelModel):
|
||||
class ShoppingListItemCreate(MealieModel):
|
||||
shopping_list_id: UUID4
|
||||
checked: bool = False
|
||||
position: int = 0
|
||||
@@ -51,11 +51,11 @@ class ShoppingListItemOut(ShoppingListItemUpdate):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class ShoppingListCreate(CamelModel):
|
||||
class ShoppingListCreate(MealieModel):
|
||||
name: str = None
|
||||
|
||||
|
||||
class ShoppingListRecipeRefOut(CamelModel):
|
||||
class ShoppingListRecipeRefOut(MealieModel):
|
||||
id: UUID4
|
||||
shopping_list_id: UUID4
|
||||
recipe_id: UUID4
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import NoneStr
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
class CreateInviteToken(CamelModel):
|
||||
|
||||
class CreateInviteToken(MealieModel):
|
||||
uses: int
|
||||
|
||||
|
||||
class SaveInviteToken(CamelModel):
|
||||
class SaveInviteToken(MealieModel):
|
||||
uses_left: int
|
||||
group_id: UUID
|
||||
token: str
|
||||
|
||||
|
||||
class ReadInviteToken(CamelModel):
|
||||
class ReadInviteToken(MealieModel):
|
||||
token: str
|
||||
uses_left: int
|
||||
group_id: UUID
|
||||
@@ -23,11 +24,11 @@ class ReadInviteToken(CamelModel):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class EmailInvitation(CamelModel):
|
||||
class EmailInvitation(MealieModel):
|
||||
email: str
|
||||
token: str
|
||||
|
||||
|
||||
class EmailInitationResponse(CamelModel):
|
||||
class EmailInitationResponse(MealieModel):
|
||||
success: bool
|
||||
error: NoneStr = None
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
class CreateWebhook(CamelModel):
|
||||
|
||||
class CreateWebhook(MealieModel):
|
||||
enabled: bool = True
|
||||
name: str = ""
|
||||
url: str = ""
|
||||
|
||||
Reference in New Issue
Block a user