mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-29 21:37:15 -05:00
Refactor/group page (#666)
* refactor(backend): ♻️ Refactor base class to be abstract and create a router factory method * feat(frontend): ✨ add group edit * refactor(backend): ✨ add group edit support Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
1
mealie/schema/group/__init__.py
Normal file
1
mealie/schema/group/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .webhook import *
|
||||
19
mealie/schema/group/webhook.py
Normal file
19
mealie/schema/group/webhook.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
|
||||
|
||||
class CreateWebhook(CamelModel):
|
||||
enabled: bool = True
|
||||
name: str = ""
|
||||
url: str = ""
|
||||
time: str = "00:00"
|
||||
|
||||
|
||||
class SaveWebhook(CreateWebhook):
|
||||
group_id: int
|
||||
|
||||
|
||||
class ReadWebhook(SaveWebhook):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic.types import constr
|
||||
@@ -119,9 +119,7 @@ class UpdateGroup(GroupBase):
|
||||
name: str
|
||||
categories: Optional[list[CategoryBase]] = []
|
||||
|
||||
webhook_urls: list[str] = []
|
||||
webhook_time: str = "00:00"
|
||||
webhook_enable: bool
|
||||
webhooks: list[Any] = []
|
||||
|
||||
|
||||
class GroupInDB(UpdateGroup):
|
||||
@@ -136,7 +134,6 @@ class GroupInDB(UpdateGroup):
|
||||
def getter_dict(_cls, orm_model: Group):
|
||||
return {
|
||||
**GetterDict(orm_model),
|
||||
"webhook_urls": [x.url for x in orm_model.webhook_urls if x],
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user