Rename severity to score

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-05-22 16:07:40 -07:00
parent ce22fa7f62
commit 9c5828b525
7 changed files with 133 additions and 116 deletions

View File

@@ -485,10 +485,10 @@ const measureRisksQuery = graphql`
description
inherentLikelihood
inherentImpact
inherentSeverity
inherentRiskScore
residualLikelihood
residualImpact
residualSeverity
residualRiskScore
createdAt
updatedAt
}
@@ -556,7 +556,7 @@ function MeasureViewContent({
}) {
const data = usePreloadedQuery<MeasureViewQueryType>(
measureViewQuery,
queryRef,
queryRef
);
// Define a type for the measure with evidences field
@@ -591,7 +591,7 @@ function MeasureViewContent({
const environment = useRelayEnvironment();
const [commitDeleteMeasure, isDeletingMeasure] = useMutation<any>(
deleteMeasureMutation,
deleteMeasureMutation
);
const [isDeleteMeasureOpen, setIsDeleteMeasureOpen] = useState(false);
@@ -615,7 +615,7 @@ function MeasureViewContent({
useState<MeasureViewLinkedControlsQuery$data | null>(null);
const [controlSearchQuery, setControlSearchQuery] = useState("");
const [selectedFrameworkId, setSelectedFrameworkId] = useState<string | null>(
null,
null
);
const [isLoadingControls, setIsLoadingControls] = useState(false);
const [isLinkingControl, setIsLinkingControl] = useState(false);
@@ -624,11 +624,11 @@ function MeasureViewContent({
// Create mutation hooks for control mapping
const [commitCreateControlMapping] =
useMutation<MeasureViewCreateControlMappingMutation>(
createControlMappingMutation,
createControlMappingMutation
);
const [commitDeleteControlMapping] =
useMutation<MeasureViewDeleteControlMappingMutation>(
deleteControlMappingMutation,
deleteControlMappingMutation
);
useEffect(() => {
@@ -652,7 +652,7 @@ function MeasureViewContent({
fetchQuery<MeasureViewLinkedControlsQuery>(
environment,
linkedControlsQuery,
{ measureId },
{ measureId }
).subscribe({
next: (data) => {
setLinkedControlsData(data);
@@ -666,7 +666,7 @@ function MeasureViewContent({
// Add state for risks data
const [risksData, setRisksData] = useState<MeasureViewRisksQuery$data | null>(
null,
null
);
// Load risks data when component mounts
@@ -713,7 +713,7 @@ function MeasureViewContent({
};
const [updateTask] = useMutation<MeasureViewUpdateTaskStateMutationType>(
updateTaskStateMutation,
updateTaskStateMutation
);
const [createTask] =
useMutation<MeasureViewCreateTaskMutationType>(createTaskMutation);
@@ -721,19 +721,19 @@ function MeasureViewContent({
useMutation<MeasureViewDeleteTaskMutationType>(deleteTaskMutation);
const [requestEvidence] = useMutation<any>(requestEvidenceMutation);
const [deleteEvidence] = useMutation<MeasureViewDeleteEvidenceMutationType>(
deleteEvidenceMutation,
deleteEvidenceMutation
);
const [assignTask] =
useMutation<MeasureViewAssignTaskMutationType>(assignTaskMutation);
const [unassignTask] =
useMutation<MeasureViewUnassignTaskMutationType>(unassignTaskMutation);
const [fulfillEvidence] = useMutation<MeasureViewFulfillEvidenceMutationType>(
fulfillEvidenceMutation,
fulfillEvidenceMutation
);
const [updateMeasureState] =
useMutation<MeasureViewUpdateMeasureStateMutationType>(
updateMeasureStateMutation,
updateMeasureStateMutation
);
const [isCreateTaskOpen, setIsCreateTaskOpen] = useState(false);
@@ -756,7 +756,7 @@ function MeasureViewContent({
const hiddenFileInputRef = useRef<HTMLInputElement>(null);
const [draggedOverTaskId, setDraggedOverTaskId] = useState<string | null>(
null,
null
);
const [uploadingTaskId, setUploadingTaskId] = useState<string | null>(null);
const [isDraggingFile, setIsDraggingFile] = useState(false);
@@ -810,7 +810,7 @@ function MeasureViewContent({
// Add state for selected task panel
const [selectedTask, setSelectedTask] = useState<(typeof tasks)[0] | null>(
null,
null
);
// Track if task panel is open
@@ -846,7 +846,7 @@ function MeasureViewContent({
}
return null;
},
[tasks],
[tasks]
);
// Add a function to get the measure evidence connection ID
@@ -1140,8 +1140,10 @@ function MeasureViewContent({
if (taskForEvidence) {
// This is a task-specific evidence
const evidenceConnectionId = getEvidenceConnectionId(taskForEvidence.id);
const evidenceConnectionId = getEvidenceConnectionId(
taskForEvidence.id
);
// Upload the URI file as task evidence
uploadTaskEvidence({
variables: {
@@ -1180,7 +1182,7 @@ function MeasureViewContent({
} else {
// This is a measure-level evidence
const evidenceConnectionId = getMeasureEvidenceConnectionId();
// Upload the URI file as measure evidence
uploadMeasureEvidence({
variables: {
@@ -1416,7 +1418,7 @@ function MeasureViewContent({
const handleDeleteEvidence = (
evidenceId: string,
filename: string,
taskId: string,
taskId: string
) => {
setEvidenceToDelete({ id: evidenceId, filename, taskId });
setIsDeleteEvidenceOpen(true);
@@ -1431,7 +1433,7 @@ function MeasureViewContent({
};
const handleFulfillEvidenceWithFile = (
e: React.ChangeEvent<HTMLInputElement>,
e: React.ChangeEvent<HTMLInputElement>
) => {
if (!e.target.files || e.target.files.length === 0 || !evidenceToFulfill)
return;
@@ -1448,7 +1450,7 @@ function MeasureViewContent({
const evidenceId = evidenceToFulfill.id;
// Get connection ID for the parent task (assuming it's available in the view)
const task = tasks.find((task) =>
task.evidences?.edges.some((edge) => edge?.node?.id === evidenceId),
task.evidences?.edges.some((edge) => edge?.node?.id === evidenceId)
);
const evidenceConnectionId = task?.id
@@ -1512,7 +1514,7 @@ function MeasureViewContent({
try {
console.log(
"Creating URI file to fulfill evidence:",
evidenceToFulfill.id,
evidenceToFulfill.id
);
// Create a URI file with the link
@@ -1529,8 +1531,8 @@ function MeasureViewContent({
// Get connection ID for the parent task
const task = tasks.find((task) =>
task.evidences?.edges.some(
(edge) => edge?.node?.id === evidenceToFulfill.id,
),
(edge) => edge?.node?.id === evidenceToFulfill.id
)
);
const evidenceConnectionId = task?.id
@@ -1687,7 +1689,7 @@ function MeasureViewContent({
toast({
title: "Measure state updated",
description: `Measure state has been updated to ${formatState(
newState,
newState
)}.`,
});
},
@@ -1741,7 +1743,7 @@ function MeasureViewContent({
return { days: "", hours: "", minutes: "" };
}
},
[],
[]
);
// Function to handle saving the updated duration
@@ -1807,7 +1809,7 @@ function MeasureViewContent({
toast,
selectedTask,
setSelectedTask,
],
]
);
// Control mapping functions
@@ -1841,7 +1843,7 @@ function MeasureViewContent({
linkedControlsQuery,
{
measureId,
},
}
).subscribe({
next: (data) => {
setLinkedControlsData(data);
@@ -1877,7 +1879,7 @@ function MeasureViewContent({
const frameworks = frameworksData.organization.frameworks.edges;
if (selectedFrameworkId) {
const selectedFramework = frameworks.find(
(edge) => edge.node.id === selectedFrameworkId,
(edge) => edge.node.id === selectedFrameworkId
);
if (selectedFramework?.node?.controls?.edges) {
@@ -1887,14 +1889,14 @@ function MeasureViewContent({
// If no framework is selected or it doesn't have controls, return controls from all frameworks
return frameworks.flatMap((framework) =>
framework.node.controls.edges.map((edge) => edge.node),
framework.node.controls.edges.map((edge) => edge.node)
);
}, [frameworksData, selectedFrameworkId]);
const getLinkedControls = useCallback(() => {
if (!linkedControlsData?.measure?.controls?.edges) return [];
return (linkedControlsData.measure.controls.edges || []).map(
(edge) => edge.node,
(edge) => edge.node
);
}, [linkedControlsData]);
@@ -1903,7 +1905,7 @@ function MeasureViewContent({
const linkedControls = getLinkedControls();
return linkedControls.some((control) => control.id === controlId);
},
[getLinkedControls],
[getLinkedControls]
);
const handleLinkControl = useCallback(
@@ -1938,7 +1940,7 @@ function MeasureViewContent({
linkedControlsQuery,
{
measureId,
},
}
).subscribe({
next: (data) => {
setLinkedControlsData(data);
@@ -1964,7 +1966,7 @@ function MeasureViewContent({
},
});
},
[commitCreateControlMapping, environment, measureId, toast],
[commitCreateControlMapping, environment, measureId, toast]
);
const handleUnlinkControl = useCallback(
@@ -1999,7 +2001,7 @@ function MeasureViewContent({
}).subscribe({
next: (data: unknown) => {
setLinkedControlsData(
data as MeasureViewLinkedControlsQuery$data,
data as MeasureViewLinkedControlsQuery$data
);
},
error: (error: Error) => {
@@ -2023,7 +2025,7 @@ function MeasureViewContent({
},
});
},
[commitDeleteControlMapping, environment, measureId, toast],
[commitDeleteControlMapping, environment, measureId, toast]
);
const handleOpenControlMappingDialog = useCallback(() => {
@@ -2041,7 +2043,7 @@ function MeasureViewContent({
control.referenceId.toLowerCase().includes(lowerQuery) ||
control.name.toLowerCase().includes(lowerQuery) ||
(control.description &&
control.description.toLowerCase().includes(lowerQuery)),
control.description.toLowerCase().includes(lowerQuery))
);
}, [controlSearchQuery, getControls]);
@@ -2086,7 +2088,7 @@ function MeasureViewContent({
const confirmDeleteMeasure = () => {
const connectionId = ConnectionHandler.getConnectionID(
organizationId!,
"MeasureListView_measures",
"MeasureListView_measures"
);
commitDeleteMeasure({
@@ -2115,7 +2117,7 @@ function MeasureViewContent({
// Add the mutation hook for uploadMeasureEvidence
const [uploadMeasureEvidence] = useMutation<any>(
uploadMeasureEvidenceMutation,
uploadMeasureEvidenceMutation
);
// Add a function to handle uploading evidence directly to the measure
@@ -2203,7 +2205,10 @@ function MeasureViewContent({
<Card className="mt-4">
<CardContent className="pt-6">
<div className="prose prose-gray prose-sm md:prose-base text-secondary max-w-3xl">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
>
{data.measure.description}
</ReactMarkdown>
</div>
@@ -2222,14 +2227,19 @@ function MeasureViewContent({
<TabsTrigger value="evidence" className="flex items-center gap-2">
<FileText className="w-4 h-4" />
Evidence
{((measureWithEvidences.evidences?.edges && measureWithEvidences.evidences.edges.length > 0) ||
tasks.some((task) => task.evidences?.edges && task.evidences.edges.length > 0)) && (
{((measureWithEvidences.evidences?.edges &&
measureWithEvidences.evidences.edges.length > 0) ||
tasks.some(
(task) =>
task.evidences?.edges && task.evidences.edges.length > 0
)) && (
<span className="ml-1.5 bg-blue-100 text-blue-800 rounded-full text-xs px-2 py-0.5">
{(measureWithEvidences.evidences?.edges?.length || 0) +
tasks.reduce(
(count, task) => count + (task.evidences?.edges?.length || 0),
0,
)}
{(measureWithEvidences.evidences?.edges?.length || 0) +
tasks.reduce(
(count, task) =>
count + (task.evidences?.edges?.length || 0),
0
)}
</span>
)}
</TabsTrigger>
@@ -2379,7 +2389,7 @@ function MeasureViewContent({
<div className="bg-white p-1.5 rounded-md border border-mid-b">
{getFileIcon(
evidence.mimeType,
evidence.type,
evidence.type
)}
</div>
<div className="flex-1 overflow-hidden">
@@ -2430,7 +2440,7 @@ function MeasureViewContent({
onClick={() =>
handleFulfillEvidence(
evidence.id,
evidence.filename,
evidence.filename
)
}
className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all"
@@ -2452,7 +2462,7 @@ function MeasureViewContent({
<Link2 className="w-4 h-4 text-blue-600" />
</button>
) : evidence.mimeType.startsWith(
"image/",
"image/"
) ? (
<button
onClick={() =>
@@ -2493,7 +2503,7 @@ function MeasureViewContent({
handleDeleteEvidence(
evidence.id,
evidence.filename,
"",
""
)
}
className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all"
@@ -2505,7 +2515,7 @@ function MeasureViewContent({
</td>
</tr>
);
},
}
)}
</tbody>
</table>
@@ -2554,7 +2564,7 @@ function MeasureViewContent({
e.stopPropagation();
handleToggleTaskState(
task.id,
task.state || "TODO",
task.state || "TODO"
);
}}
>
@@ -2563,7 +2573,11 @@ function MeasureViewContent({
)}
</div>
<h3
className={`font-medium ${task.state === "DONE" ? "line-through text-secondary" : ""}`}
className={`font-medium ${
task.state === "DONE"
? "line-through text-secondary"
: ""
}`}
>
{task.name}
</h3>
@@ -2728,20 +2742,20 @@ function MeasureViewContent({
<Badge
variant="outline"
className={getRiskSeverityColor(
risk.inherentSeverity,
risk.inherentRiskScore
)}
>
Inherent:{" "}
{getRiskSeverityText(risk.inherentSeverity)}
{getRiskSeverityText(risk.inherentRiskScore)}
</Badge>
<Badge
variant="outline"
className={getRiskSeverityColor(
risk.residualSeverity,
risk.residualRiskScore
)}
>
Residual:{" "}
{getRiskSeverityText(risk.residualSeverity)}
{getRiskSeverityText(risk.residualRiskScore)}
</Badge>
</div>
</div>
@@ -2833,7 +2847,10 @@ function MeasureViewContent({
Description
</h3>
<div className="prose prose-gray prose-sm max-w-none text-primary bg-invert-bg p-4 rounded-md border border-mid-b">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
>
{selectedTask.description}
</ReactMarkdown>
</div>
@@ -2923,7 +2940,7 @@ function MeasureViewContent({
onClick={() =>
handleAssignPerson(
selectedTask.id,
person.id,
person.id
)
}
>
@@ -3028,7 +3045,7 @@ function MeasureViewContent({
onClick={() => {
// Parse current duration into components
const { days, hours, minutes } = parseISODuration(
selectedTask.timeEstimate,
selectedTask.timeEstimate
);
setEditTimeEstimateDays(days);
setEditTimeEstimateHours(hours);
@@ -3055,7 +3072,7 @@ function MeasureViewContent({
onClick={() =>
handleCreateEvidence(
selectedTask.id,
selectedTask.name,
selectedTask.name
)
}
>
@@ -3080,7 +3097,7 @@ function MeasureViewContent({
<div className="bg-white p-1.5 rounded-md border border-mid-b">
{getFileIcon(
evidence.mimeType,
evidence.type,
evidence.type
)}
</div>
<div>
@@ -3108,7 +3125,7 @@ function MeasureViewContent({
onClick={() =>
handleFulfillEvidence(
evidence.id,
evidence.filename,
evidence.filename
)
}
className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all"
@@ -3130,7 +3147,7 @@ function MeasureViewContent({
<Link2 className="w-4 h-4 text-blue-600" />
</button>
) : evidence.mimeType.startsWith(
"image/",
"image/"
) ? (
<button
onClick={() =>
@@ -3171,7 +3188,7 @@ function MeasureViewContent({
handleDeleteEvidence(
evidence.id,
evidence.filename,
selectedTask.id,
selectedTask.id
)
}
className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all"
@@ -3206,7 +3223,7 @@ function MeasureViewContent({
onClick={() =>
handleToggleTaskState(
selectedTask.id,
selectedTask.state || "TODO",
selectedTask.state || "TODO"
)
}
>
@@ -3221,7 +3238,7 @@ function MeasureViewContent({
if (selectedTask) {
handleToggleTaskState(
selectedTask.id,
selectedTask.state || "DONE",
selectedTask.state || "DONE"
);
}
}}
@@ -3646,7 +3663,7 @@ function MeasureViewContent({
<SelectItem key={edge.node.id} value={edge.node.id}>
{edge.node.name}
</SelectItem>
),
)
)}
</SelectContent>
</Select>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f1eccfbde625d131166d0fac7f4613aa>>
* @generated SignedSource<<bcc2641c30833b1da31cfcc88d18ffea>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -23,11 +23,11 @@ export type MeasureViewRisksQuery$data = {
readonly id: string;
readonly inherentImpact: number;
readonly inherentLikelihood: number;
readonly inherentSeverity: number;
readonly inherentRiskScore: number;
readonly name: string;
readonly residualImpact: number;
readonly residualLikelihood: number;
readonly residualSeverity: number;
readonly residualRiskScore: number;
readonly updatedAt: string;
};
}>;
@@ -118,7 +118,7 @@ v4 = [
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "inherentSeverity",
"name": "inherentRiskScore",
"storageKey": null
},
{
@@ -139,7 +139,7 @@ v4 = [
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "residualSeverity",
"name": "residualRiskScore",
"storageKey": null
},
{
@@ -291,7 +291,7 @@ return {
]
},
"params": {
"cacheID": "e0a3387051cf8312a5ac831f1a9012df",
"cacheID": "b04e121f2347f02738178eb93d1a437d",
"id": null,
"metadata": {
"connection": [
@@ -308,11 +308,11 @@ return {
},
"name": "MeasureViewRisksQuery",
"operationKind": "query",
"text": "query MeasureViewRisksQuery(\n $measureId: ID!\n) {\n measure: node(id: $measureId) {\n __typename\n id\n ... on Measure {\n risks(first: 100) {\n edges {\n node {\n id\n name\n description\n inherentLikelihood\n inherentImpact\n inherentSeverity\n residualLikelihood\n residualImpact\n residualSeverity\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
"text": "query MeasureViewRisksQuery(\n $measureId: ID!\n) {\n measure: node(id: $measureId) {\n __typename\n id\n ... on Measure {\n risks(first: 100) {\n edges {\n node {\n id\n name\n description\n inherentLikelihood\n inherentImpact\n inherentRiskScore\n residualLikelihood\n residualImpact\n residualRiskScore\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "22056b7f008dc87a4ad410bacac9a838";
(node as any).hash = "a66b2e9bdc293b6fe9a7737a09610c13";
export default node;

View File

@@ -56,11 +56,11 @@ func (r *Risk) CursorKey(orderBy RiskOrderField) page.CursorKey {
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
}
func (r *Risk) InherentSeverity() int {
func (r *Risk) InherentRiskScore() int {
return r.InherentLikelihood * r.InherentImpact
}
func (r *Risk) ResidualSeverity() int {
func (r *Risk) ResidualRiskScore() int {
return r.ResidualLikelihood * r.ResidualImpact
}

View File

@@ -732,10 +732,10 @@ type Risk implements Node {
treatment: RiskTreatment!
inherentLikelihood: Int!
inherentImpact: Int!
inherentSeverity: Int!
inherentRiskScore: Int!
residualLikelihood: Int!
residualImpact: Int!
residualSeverity: Int!
residualRiskScore: Int!
note: String!
owner: People @goField(forceResolver: true)

View File

@@ -528,7 +528,7 @@ type ComplexityRoot struct {
ID func(childComplexity int) int
InherentImpact func(childComplexity int) int
InherentLikelihood func(childComplexity int) int
InherentSeverity func(childComplexity int) int
InherentRiskScore func(childComplexity int) int
Measures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy) int
Name func(childComplexity int) int
Note func(childComplexity int) int
@@ -537,7 +537,7 @@ type ComplexityRoot struct {
Policies func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyOrderBy) int
ResidualImpact func(childComplexity int) int
ResidualLikelihood func(childComplexity int) int
ResidualSeverity func(childComplexity int) int
ResidualRiskScore func(childComplexity int) int
Treatment func(childComplexity int) int
UpdatedAt func(childComplexity int) int
}
@@ -2974,12 +2974,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Risk.InherentLikelihood(childComplexity), true
case "Risk.inherentSeverity":
if e.complexity.Risk.InherentSeverity == nil {
case "Risk.inherentRiskScore":
if e.complexity.Risk.InherentRiskScore == nil {
break
}
return e.complexity.Risk.InherentSeverity(childComplexity), true
return e.complexity.Risk.InherentRiskScore(childComplexity), true
case "Risk.measures":
if e.complexity.Risk.Measures == nil {
@@ -3047,12 +3047,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Risk.ResidualLikelihood(childComplexity), true
case "Risk.residualSeverity":
if e.complexity.Risk.ResidualSeverity == nil {
case "Risk.residualRiskScore":
if e.complexity.Risk.ResidualRiskScore == nil {
break
}
return e.complexity.Risk.ResidualSeverity(childComplexity), true
return e.complexity.Risk.ResidualRiskScore(childComplexity), true
case "Risk.treatment":
if e.complexity.Risk.Treatment == nil {
@@ -4703,10 +4703,10 @@ type Risk implements Node {
treatment: RiskTreatment!
inherentLikelihood: Int!
inherentImpact: Int!
inherentSeverity: Int!
inherentRiskScore: Int!
residualLikelihood: Int!
residualImpact: Int!
residualSeverity: Int!
residualRiskScore: Int!
note: String!
owner: People @goField(forceResolver: true)
@@ -22269,8 +22269,8 @@ func (ec *executionContext) fieldContext_Risk_inherentImpact(_ context.Context,
return fc, nil
}
func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_inherentSeverity(ctx, field)
func (ec *executionContext) _Risk_inherentRiskScore(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_inherentRiskScore(ctx, field)
if err != nil {
return graphql.Null
}
@@ -22283,7 +22283,7 @@ func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field gr
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.InherentSeverity, nil
return obj.InherentRiskScore, nil
})
if err != nil {
ec.Error(ctx, err)
@@ -22300,7 +22300,7 @@ func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field gr
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Risk_inherentSeverity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_Risk_inherentRiskScore(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Risk",
Field: field,
@@ -22401,8 +22401,8 @@ func (ec *executionContext) fieldContext_Risk_residualImpact(_ context.Context,
return fc, nil
}
func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_residualSeverity(ctx, field)
func (ec *executionContext) _Risk_residualRiskScore(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_residualRiskScore(ctx, field)
if err != nil {
return graphql.Null
}
@@ -22415,7 +22415,7 @@ func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field gr
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.ResidualSeverity, nil
return obj.ResidualRiskScore, nil
})
if err != nil {
ec.Error(ctx, err)
@@ -22432,7 +22432,7 @@ func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field gr
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Risk_residualSeverity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_Risk_residualRiskScore(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Risk",
Field: field,
@@ -23092,14 +23092,14 @@ func (ec *executionContext) fieldContext_RiskEdge_node(_ context.Context, field
return ec.fieldContext_Risk_inherentLikelihood(ctx, field)
case "inherentImpact":
return ec.fieldContext_Risk_inherentImpact(ctx, field)
case "inherentSeverity":
return ec.fieldContext_Risk_inherentSeverity(ctx, field)
case "inherentRiskScore":
return ec.fieldContext_Risk_inherentRiskScore(ctx, field)
case "residualLikelihood":
return ec.fieldContext_Risk_residualLikelihood(ctx, field)
case "residualImpact":
return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity":
return ec.fieldContext_Risk_residualSeverity(ctx, field)
case "residualRiskScore":
return ec.fieldContext_Risk_residualRiskScore(ctx, field)
case "note":
return ec.fieldContext_Risk_note(ctx, field)
case "owner":
@@ -24550,14 +24550,14 @@ func (ec *executionContext) fieldContext_UpdateRiskPayload_risk(_ context.Contex
return ec.fieldContext_Risk_inherentLikelihood(ctx, field)
case "inherentImpact":
return ec.fieldContext_Risk_inherentImpact(ctx, field)
case "inherentSeverity":
return ec.fieldContext_Risk_inherentSeverity(ctx, field)
case "inherentRiskScore":
return ec.fieldContext_Risk_inherentRiskScore(ctx, field)
case "residualLikelihood":
return ec.fieldContext_Risk_residualLikelihood(ctx, field)
case "residualImpact":
return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity":
return ec.fieldContext_Risk_residualSeverity(ctx, field)
case "residualRiskScore":
return ec.fieldContext_Risk_residualRiskScore(ctx, field)
case "note":
return ec.fieldContext_Risk_note(ctx, field)
case "owner":
@@ -37951,8 +37951,8 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "inherentSeverity":
out.Values[i] = ec._Risk_inherentSeverity(ctx, field, obj)
case "inherentRiskScore":
out.Values[i] = ec._Risk_inherentRiskScore(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
@@ -37966,8 +37966,8 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "residualSeverity":
out.Values[i] = ec._Risk_residualSeverity(ctx, field, obj)
case "residualRiskScore":
out.Values[i] = ec._Risk_residualRiskScore(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}

View File

@@ -51,10 +51,10 @@ func NewRisk(r *coredata.Risk) *Risk {
Treatment: r.Treatment,
InherentLikelihood: r.InherentLikelihood,
InherentImpact: r.InherentImpact,
InherentSeverity: r.InherentSeverity(),
InherentRiskScore: r.InherentRiskScore(),
ResidualLikelihood: r.ResidualLikelihood,
ResidualImpact: r.ResidualImpact,
ResidualSeverity: r.ResidualSeverity(),
ResidualRiskScore: r.ResidualRiskScore(),
Category: r.Category,
CreatedAt: r.CreatedAt,
UpdatedAt: r.UpdatedAt,

View File

@@ -712,10 +712,10 @@ type Risk struct {
Treatment coredata.RiskTreatment `json:"treatment"`
InherentLikelihood int `json:"inherentLikelihood"`
InherentImpact int `json:"inherentImpact"`
InherentSeverity int `json:"inherentSeverity"`
InherentRiskScore int `json:"inherentRiskScore"`
ResidualLikelihood int `json:"residualLikelihood"`
ResidualImpact int `json:"residualImpact"`
ResidualSeverity int `json:"residualSeverity"`
ResidualRiskScore int `json:"residualRiskScore"`
Note string `json:"note"`
Owner *People `json:"owner,omitempty"`
Organization *Organization `json:"organization"`