fix(tests): apply user edits when creating test from template

The form captured name/description/platform/procedure/tool edits but
never sent them — the created test always used the raw template values.

- TestTemplateInstantiate schema: add optional override fields
  (name, description, platform, procedure_text, tool_used)
- create_test_from_template service: accept *_override kwargs;
  use override value when provided, fall back to template value
- Router: pass all override fields from payload to service
- Frontend API createTestFromTemplate: accept overrides object, spread into body
- TestFromTemplateForm: pass all form state values as overrides
This commit is contained in:
kitos
2026-05-28 16:38:40 +02:00
parent 785b5b44a3
commit 965ff96433
5 changed files with 45 additions and 8 deletions
+9 -1
View File
@@ -91,14 +91,22 @@ export async function createTest(payload: TestCreatePayload): Promise<Test> {
return data;
}
/** Create a test from an existing template. */
/** Create a test from an existing template, with optional field overrides. */
export async function createTestFromTemplate(
templateId: string,
techniqueId: string,
overrides?: {
name?: string;
description?: string;
platform?: string;
procedure_text?: string;
tool_used?: string;
},
): Promise<Test> {
const { data } = await client.post<Test>("/tests/from-template", {
template_id: templateId,
technique_id: techniqueId,
...overrides,
});
return data;
}