fix(entry-modules): persist route path updates
This commit is contained in:
@@ -86,6 +86,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService):
|
||||
|
||||
async def CreateModule(self, Body: EntryModuleCreateDTO) -> EntryModuleVO:
|
||||
"""创建入口模块。"""
|
||||
route_path = (Body.route_path if Body.route_path is not None else Body.path or "").strip() or None
|
||||
async with GetAsyncSession() as Session:
|
||||
try:
|
||||
row = (
|
||||
@@ -103,7 +104,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService):
|
||||
{
|
||||
"name": Body.name.strip(),
|
||||
"description": (Body.description or "").strip() or None,
|
||||
"route_path": (Body.path or "").strip() or None,
|
||||
"route_path": route_path,
|
||||
"icon_path": None,
|
||||
"areas": self._areasJson(Body.areas),
|
||||
"sort_order": await self._nextSortOrder(Session),
|
||||
@@ -119,6 +120,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService):
|
||||
async def UpdateModule(self, ModuleId: int, Body: EntryModuleUpdateDTO) -> EntryModuleVO:
|
||||
"""更新入口模块。"""
|
||||
current = await self._getModuleRow(ModuleId)
|
||||
incoming_route_path = Body.route_path if Body.route_path is not None else Body.path
|
||||
async with GetAsyncSession() as Session:
|
||||
row = (
|
||||
await Session.execute(
|
||||
@@ -140,7 +142,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService):
|
||||
"module_id": ModuleId,
|
||||
"name": Body.name.strip() if Body.name is not None else current["name"],
|
||||
"description": (Body.description.strip() if Body.description is not None else current["description"]),
|
||||
"route_path": (Body.path.strip() if Body.path is not None else current["path"]),
|
||||
"route_path": (incoming_route_path.strip() if incoming_route_path is not None else current["path"]),
|
||||
"areas": self._areasJson(Body.areas) if Body.areas is not None else self._areasJson(current["areas"]),
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user