Don't need parent. Just use the whole path for the group id
This commit is contained in:
parent
f8878e0f77
commit
586ed3166f
|
@ -1620,8 +1620,6 @@ components:
|
|||
type: string
|
||||
name:
|
||||
type: string
|
||||
parent:
|
||||
type: string
|
||||
display_name:
|
||||
type: string
|
||||
display_order:
|
||||
|
|
|
@ -20,7 +20,6 @@ class ProcessGroup:
|
|||
|
||||
id: str # A unique string name, lower case, under scores (ie, 'my_group')
|
||||
display_name: str
|
||||
parent: str = ''
|
||||
display_order: int | None = 0
|
||||
admin: bool | None = False
|
||||
process_models: list[ProcessModelInfo] = field(
|
||||
|
@ -47,7 +46,7 @@ class ProcessGroupSchema(Schema):
|
|||
"""Meta."""
|
||||
|
||||
model = ProcessGroup
|
||||
fields = ["id", "display_name", "display_order", "admin", "process_models", "parent"]
|
||||
fields = ["id", "display_name", "display_order", "admin", "process_models"]
|
||||
|
||||
process_models = marshmallow.fields.List(
|
||||
marshmallow.fields.Nested(
|
||||
|
|
|
@ -32,9 +32,9 @@ class FileSystemService:
|
|||
return os.path.join(app_root, "..", dir_name)
|
||||
|
||||
@staticmethod
|
||||
def process_group_path(name: str, parent: str) -> str:
|
||||
def process_group_path(name: str) -> str:
|
||||
"""Category_path."""
|
||||
return os.path.join(FileSystemService.root_path(), parent, name)
|
||||
return os.path.join(FileSystemService.root_path(), name)
|
||||
|
||||
@staticmethod
|
||||
def full_path_from_relative_path(relative_path: str) -> str:
|
||||
|
|
|
@ -189,7 +189,7 @@ class ProcessModelService(FileSystemService):
|
|||
|
||||
def update_process_group(self, process_group: ProcessGroup) -> ProcessGroup:
|
||||
"""Update_process_group."""
|
||||
cat_path = self.process_group_path(process_group.id, process_group.parent)
|
||||
cat_path = self.process_group_path(process_group.id)
|
||||
os.makedirs(cat_path, exist_ok=True)
|
||||
json_path = os.path.join(cat_path, self.CAT_JSON_FILE)
|
||||
with open(json_path, "w") as cat_json:
|
||||
|
|
|
@ -54,11 +54,10 @@ class TestNestedGroups(BaseTest):
|
|||
)
|
||||
|
||||
process_group_b = ProcessGroup(
|
||||
id="group_b",
|
||||
id="group_a/group_b",
|
||||
display_name="Group B",
|
||||
display_order=0,
|
||||
admin=False,
|
||||
parent='group_a'
|
||||
)
|
||||
response_b = client.post(
|
||||
"/v1.0/process-groups",
|
||||
|
@ -68,11 +67,10 @@ class TestNestedGroups(BaseTest):
|
|||
)
|
||||
|
||||
process_group_c = ProcessGroup(
|
||||
id="group_c",
|
||||
id="group_a/group_b/group_c",
|
||||
display_name="Group C",
|
||||
display_order=0,
|
||||
admin=False,
|
||||
parent='group_a/group_b'
|
||||
)
|
||||
response_c = client.post(
|
||||
"/v1.0/process-groups",
|
||||
|
@ -104,11 +102,10 @@ class TestNestedGroups(BaseTest):
|
|||
)
|
||||
|
||||
process_group_b = ProcessGroup(
|
||||
id="group_b",
|
||||
id="group_a/group_b",
|
||||
display_name="Group B",
|
||||
display_order=0,
|
||||
admin=False,
|
||||
parent='group_a'
|
||||
)
|
||||
response_b = client.post(
|
||||
"/v1.0/process-groups",
|
||||
|
|
Loading…
Reference in New Issue