mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
Feature/user seedable foods (#1176)
* remove odd ingredients * UI Elements for food * update translated percentage * spek -> speck * generate types * seeder api endpoints + tests * implement foods seeder UI * localize some food strings
This commit is contained in:
parent
67178f9b74
commit
d6e2b4ab85
60 changed files with 478 additions and 172 deletions
|
@ -5,6 +5,7 @@ from .group_exports import *
|
|||
from .group_migration import *
|
||||
from .group_permissions import *
|
||||
from .group_preferences import *
|
||||
from .group_seeder import *
|
||||
from .group_shopping_list import *
|
||||
from .group_statistics import *
|
||||
from .invite_token import *
|
||||
|
|
53
mealie/schema/group/group_seeder.py
Normal file
53
mealie/schema/group/group_seeder.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
from pydantic import validator
|
||||
|
||||
from mealie.schema._mealie.mealie_model import MealieModel
|
||||
|
||||
|
||||
def validate_locale(locale: str) -> bool:
|
||||
valid = {
|
||||
"el-GR",
|
||||
"it-IT",
|
||||
"ko-KR",
|
||||
"es-ES",
|
||||
"ja-JP",
|
||||
"zh-CN",
|
||||
"tr-TR",
|
||||
"ar-SA",
|
||||
"hu-HU",
|
||||
"pt-PT",
|
||||
"no-NO",
|
||||
"sv-SE",
|
||||
"ro-RO",
|
||||
"sk-SK",
|
||||
"uk-UA",
|
||||
"fr-CA",
|
||||
"pl-PL",
|
||||
"da-DK",
|
||||
"pt-BR",
|
||||
"de-DE",
|
||||
"ca-ES",
|
||||
"sr-SP",
|
||||
"cs-CZ",
|
||||
"fr-FR",
|
||||
"zh-TW",
|
||||
"af-ZA",
|
||||
"ru-RU",
|
||||
"he-IL",
|
||||
"nl-NL",
|
||||
"en-US",
|
||||
"en-GB",
|
||||
"fi-FI",
|
||||
"vi-VN",
|
||||
}
|
||||
|
||||
return locale in valid
|
||||
|
||||
|
||||
class SeederConfig(MealieModel):
|
||||
locale: str
|
||||
|
||||
@validator("locale")
|
||||
def valid_locale(cls, v, values, **kwargs):
|
||||
if not validate_locale(v):
|
||||
raise ValueError("passwords do not match")
|
||||
return v
|
Loading…
Add table
Add a link
Reference in a new issue