1
0
Fork 0
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:
Hayden 2022-05-01 12:45:50 -08:00 committed by GitHub
parent 67178f9b74
commit d6e2b4ab85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 478 additions and 172 deletions

View file

@ -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 *

View 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