mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-10 12:25:14 -05:00
feat(backend): ✨ refactor/fix group management for admins (#838)
* fix(frontend): 🐛 update dialog implementation to simplify state management * test(backend): ✅ refactor test fixtures + admin group tests * chore(backend): 🔨 add launcher.json for python debugging (tests) * fix typing * feat(backend): ✨ refactor/fix group management for admins * feat(frontend): ✨ add/fix admin group management * add LDAP checker Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -27,4 +27,5 @@ class AdminAboutInfo(AppInfo):
|
||||
|
||||
class CheckAppConfig(CamelModel):
|
||||
email_ready: bool = False
|
||||
ldap_ready: bool = False
|
||||
base_url_set: bool = False
|
||||
|
||||
9
mealie/schema/group/group.py
Normal file
9
mealie/schema/group/group.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
|
||||
from .group_preferences import UpdateGroupPreferences
|
||||
|
||||
|
||||
class GroupAdminUpdate(CamelModel):
|
||||
id: int
|
||||
name: str
|
||||
preferences: UpdateGroupPreferences
|
||||
18
mealie/schema/mapper.py
Normal file
18
mealie/schema/mapper.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
T = TypeVar("T", bound=BaseModel)
|
||||
U = TypeVar("U", bound=BaseModel)
|
||||
|
||||
|
||||
def mapper(source: U, dest: T, **kwargs) -> Generic[T]:
|
||||
"""
|
||||
Map a source model to a destination model. Only top-level fields are mapped.
|
||||
"""
|
||||
|
||||
for field in source.__fields__:
|
||||
if field in dest.__fields__:
|
||||
setattr(dest, field, getattr(source, field))
|
||||
|
||||
return dest
|
||||
Reference in New Issue
Block a user