feat(test-catalog): add template creation and lead-approval workflow
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Leads get a Create Template button that adds directly to the catalog (existing POST /test-templates). Operators (red_tech/blue_tech) get the same button, but their proposal now lands in a new template_suggestions review queue instead — a lead on their team can approve it as-is, edit fields before approving, or discard it. Modeled on the existing ProcedureSuggestion review workflow.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import client from "./client";
|
||||
import type { TemplateSuggestion } from "../types/models";
|
||||
import type { CreateTemplatePayload } from "./test-templates";
|
||||
|
||||
/** Propose a new test template. Lands in the review queue, not the live catalog. */
|
||||
export async function proposeTemplate(
|
||||
payload: CreateTemplatePayload,
|
||||
): Promise<TemplateSuggestion> {
|
||||
const { data } = await client.post<TemplateSuggestion>(
|
||||
"/template-suggestions",
|
||||
payload,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** List pending template suggestions, scoped to the caller's team (admins see both). */
|
||||
export async function getTemplateSuggestions(): Promise<TemplateSuggestion[]> {
|
||||
const { data } = await client.get<TemplateSuggestion[]>("/template-suggestions");
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Approve a suggestion, optionally editing fields, creating the real template. */
|
||||
export async function approveTemplateSuggestion(
|
||||
id: string,
|
||||
overrides?: Partial<CreateTemplatePayload>,
|
||||
): Promise<TemplateSuggestion> {
|
||||
const { data } = await client.post<TemplateSuggestion>(
|
||||
`/template-suggestions/${id}/approve`,
|
||||
overrides || {},
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Discard a suggestion without creating a template. */
|
||||
export async function rejectTemplateSuggestion(id: string): Promise<TemplateSuggestion> {
|
||||
const { data } = await client.post<TemplateSuggestion>(`/template-suggestions/${id}/reject`);
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user