mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-30 11:45:48 +00:00
Don't need parent. Just use the whole path for the group id
This commit is contained in:
parent
82bb4bac59
commit
0642c16467
@ -1620,8 +1620,6 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
parent:
|
|
||||||
type: string
|
|
||||||
display_name:
|
display_name:
|
||||||
type: string
|
type: string
|
||||||
display_order:
|
display_order:
|
||||||
|
@ -20,7 +20,6 @@ class ProcessGroup:
|
|||||||
|
|
||||||
id: str # A unique string name, lower case, under scores (ie, 'my_group')
|
id: str # A unique string name, lower case, under scores (ie, 'my_group')
|
||||||
display_name: str
|
display_name: str
|
||||||
parent: str = ''
|
|
||||||
display_order: int | None = 0
|
display_order: int | None = 0
|
||||||
admin: bool | None = False
|
admin: bool | None = False
|
||||||
process_models: list[ProcessModelInfo] = field(
|
process_models: list[ProcessModelInfo] = field(
|
||||||
@ -47,7 +46,7 @@ class ProcessGroupSchema(Schema):
|
|||||||
"""Meta."""
|
"""Meta."""
|
||||||
|
|
||||||
model = ProcessGroup
|
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(
|
process_models = marshmallow.fields.List(
|
||||||
marshmallow.fields.Nested(
|
marshmallow.fields.Nested(
|
||||||
|
@ -32,9 +32,9 @@ class FileSystemService:
|
|||||||
return os.path.join(app_root, "..", dir_name)
|
return os.path.join(app_root, "..", dir_name)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def process_group_path(name: str, parent: str) -> str:
|
def process_group_path(name: str) -> str:
|
||||||
"""Category_path."""
|
"""Category_path."""
|
||||||
return os.path.join(FileSystemService.root_path(), parent, name)
|
return os.path.join(FileSystemService.root_path(), name)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def full_path_from_relative_path(relative_path: str) -> str:
|
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:
|
def update_process_group(self, process_group: ProcessGroup) -> ProcessGroup:
|
||||||
"""Update_process_group."""
|
"""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)
|
os.makedirs(cat_path, exist_ok=True)
|
||||||
json_path = os.path.join(cat_path, self.CAT_JSON_FILE)
|
json_path = os.path.join(cat_path, self.CAT_JSON_FILE)
|
||||||
with open(json_path, "w") as cat_json:
|
with open(json_path, "w") as cat_json:
|
||||||
|
@ -54,11 +54,10 @@ class TestNestedGroups(BaseTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
process_group_b = ProcessGroup(
|
process_group_b = ProcessGroup(
|
||||||
id="group_b",
|
id="group_a/group_b",
|
||||||
display_name="Group B",
|
display_name="Group B",
|
||||||
display_order=0,
|
display_order=0,
|
||||||
admin=False,
|
admin=False,
|
||||||
parent='group_a'
|
|
||||||
)
|
)
|
||||||
response_b = client.post(
|
response_b = client.post(
|
||||||
"/v1.0/process-groups",
|
"/v1.0/process-groups",
|
||||||
@ -68,11 +67,10 @@ class TestNestedGroups(BaseTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
process_group_c = ProcessGroup(
|
process_group_c = ProcessGroup(
|
||||||
id="group_c",
|
id="group_a/group_b/group_c",
|
||||||
display_name="Group C",
|
display_name="Group C",
|
||||||
display_order=0,
|
display_order=0,
|
||||||
admin=False,
|
admin=False,
|
||||||
parent='group_a/group_b'
|
|
||||||
)
|
)
|
||||||
response_c = client.post(
|
response_c = client.post(
|
||||||
"/v1.0/process-groups",
|
"/v1.0/process-groups",
|
||||||
@ -104,11 +102,10 @@ class TestNestedGroups(BaseTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
process_group_b = ProcessGroup(
|
process_group_b = ProcessGroup(
|
||||||
id="group_b",
|
id="group_a/group_b",
|
||||||
display_name="Group B",
|
display_name="Group B",
|
||||||
display_order=0,
|
display_order=0,
|
||||||
admin=False,
|
admin=False,
|
||||||
parent='group_a'
|
|
||||||
)
|
)
|
||||||
response_b = client.post(
|
response_b = client.post(
|
||||||
"/v1.0/process-groups",
|
"/v1.0/process-groups",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user