Add note to risk

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-04-24 17:47:39 -07:00
parent 60cdc8f19f
commit cece072619
17 changed files with 254 additions and 66 deletions

View File

@@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
## [0.13.1] - 2025-04-24
### Added
- Risk can have note
## [0.13.2] - 2025-04-24
### Fixed

View File

@@ -52,6 +52,7 @@ const editRiskViewQuery = graphql`
residualLikelihood
residualImpact
treatment
note
owner {
id
fullName
@@ -78,6 +79,7 @@ const updateRiskMutation = graphql`
residualLikelihood
residualImpact
treatment
note
updatedAt
owner {
id
@@ -107,6 +109,7 @@ function EditRiskViewContent({
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [category, setCategory] = useState("");
const [note, setNote] = useState("");
const [inherentLikelihood, setInherentLikelihood] = useState<number>(3);
const [inherentImpact, setInherentImpact] = useState<number>(3);
const [residualLikelihood, setResidualLikelihood] = useState<number>(3);
@@ -124,6 +127,7 @@ function EditRiskViewContent({
setName(risk.name || "");
setDescription(risk.description || "");
setCategory(risk.category || "");
setNote(risk.note || "");
// Set values directly as integers
setInherentLikelihood(risk.inherentLikelihood || 3);
setInherentImpact(risk.inherentImpact || 3);
@@ -158,6 +162,7 @@ function EditRiskViewContent({
residualLikelihood,
residualImpact,
treatment,
note,
ownerId: ownerId || undefined,
};
@@ -241,6 +246,17 @@ function EditRiskViewContent({
/>
</div>
<div className="space-y-2">
<Label htmlFor="note">Note</Label>
<Textarea
id="note"
placeholder="Add any additional note about this risk"
value={note}
onChange={(e) => setNote(e.target.value)}
rows={3}
/>
</div>
<div className="space-y-2">
<Label htmlFor="owner" className="flex items-center gap-2">
<User className="h-4 w-4" />

View File

@@ -95,6 +95,7 @@ function NewRiskForm({
const [residualImpact, setResidualImpact] = useState<number>(3);
const [treatment, setTreatment] = useState<string>("MITIGATED");
const [ownerId, setOwnerId] = useState<string | null>(null);
const [note, setNote] = useState<string>("");
const [isSubmitting, setIsSubmitting] = useState(false);
const [selectedTemplate, setSelectedTemplate] = useState<string>("");
const [selectedCategory, setSelectedCategory] = useState<string>("");
@@ -216,6 +217,7 @@ function NewRiskForm({
residualImpact,
treatment,
ownerId: ownerId || undefined,
note,
};
createRisk({
@@ -424,6 +426,20 @@ function NewRiskForm({
</p>
</div>
<div className="space-y-2">
<Label htmlFor="note">Notes</Label>
<Textarea
id="note"
placeholder="Add any additional notes about this risk"
value={note}
onChange={(e) => setNote(e.target.value)}
rows={3}
/>
<p className="text-sm text-tertiary">
Optional notes to provide more context about the risk
</p>
</div>
<Separator className="my-4" />
<div>

View File

@@ -82,6 +82,7 @@ const showRiskViewQuery = graphql`
inherentImpact
residualLikelihood
residualImpact
note
createdAt
updatedAt
mesures(first: 100) @connection(key: "Risk__mesures") {
@@ -1010,6 +1011,19 @@ function ShowRiskViewContent({
</CardContent>
</Card>
{risk.note && (
<Card>
<CardHeader className="pb-2">
<CardTitle>Note</CardTitle>
</CardHeader>
<CardContent>
<div className="prose prose-sm max-w-none">
{risk.note}
</div>
</CardContent>
</Card>
)}
<Tabs defaultValue="mesures" className="w-full">
<TabsList>
<TabsTrigger value="mesures">Mesures</TabsTrigger>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<028d64b4c532fdc04b77de62bd70311b>>
* @generated SignedSource<<0637df266d41a7d8d4a54f4ecaf2b6ed>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -26,6 +26,7 @@ export type EditRiskViewQuery$data = {
readonly inherentImpact?: number;
readonly inherentLikelihood?: number;
readonly name?: string;
readonly note?: string;
readonly owner?: {
readonly fullName: string;
readonly id: string;
@@ -125,10 +126,17 @@ v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"name": "note",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
v14 = {
"alias": null,
"args": null,
"concreteType": "People",
@@ -137,25 +145,25 @@ v13 = {
"plural": false,
"selections": [
(v3/*: any*/),
(v12/*: any*/)
(v13/*: any*/)
],
"storageKey": null
},
v14 = [
v15 = [
{
"kind": "Variable",
"name": "id",
"variableName": "organizationId"
}
],
v15 = {
v16 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v16 = [
v17 = [
{
"kind": "Literal",
"name": "first",
@@ -200,7 +208,8 @@ return {
(v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"type": "Risk",
"abstractKey": null
@@ -210,7 +219,7 @@ return {
},
{
"alias": "organization",
"args": (v14/*: any*/),
"args": (v15/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
@@ -245,7 +254,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v15/*: any*/),
(v16/*: any*/),
(v3/*: any*/),
{
"kind": "InlineFragment",
@@ -258,7 +267,8 @@ return {
(v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"type": "Risk",
"abstractKey": null
@@ -268,20 +278,20 @@ return {
},
{
"alias": "organization",
"args": (v14/*: any*/),
"args": (v15/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v15/*: any*/),
(v16/*: any*/),
(v3/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v16/*: any*/),
"args": (v17/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -304,7 +314,7 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": null,
"args": null,
@@ -312,7 +322,7 @@ return {
"name": "primaryEmailAddress",
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
"storageKey": null
},
@@ -356,7 +366,7 @@ return {
},
{
"alias": null,
"args": (v16/*: any*/),
"args": (v17/*: any*/),
"filters": [
"orderBy"
],
@@ -375,16 +385,16 @@ return {
]
},
"params": {
"cacheID": "cdae5e406ef1b70c372791cc998e82ac",
"cacheID": "d12002d4d1efd523c4f048d068e78644",
"id": null,
"metadata": {},
"name": "EditRiskViewQuery",
"operationKind": "query",
"text": "query EditRiskViewQuery(\n $riskId: ID!\n $organizationId: ID!\n) {\n risk: node(id: $riskId) {\n __typename\n ... on Risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n owner {\n id\n fullName\n }\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
"text": "query EditRiskViewQuery(\n $riskId: ID!\n $organizationId: ID!\n) {\n risk: node(id: $riskId) {\n __typename\n ... on Risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n note\n owner {\n id\n fullName\n }\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
(node as any).hash = "3ea38c607c8a1d3f18eaa964476f1529";
(node as any).hash = "44e4278c5a81cde3ab21584cb4f6de83";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5a97a0d2387d66d74de35ec9b5bc86cf>>
* @generated SignedSource<<8241dc0eb1cf23f48be022628e0ab2b3>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -17,6 +17,7 @@ export type UpdateRiskInput = {
inherentImpact?: number | null | undefined;
inherentLikelihood?: number | null | undefined;
name?: string | null | undefined;
note?: string | null | undefined;
ownerId?: string | null | undefined;
residualImpact?: number | null | undefined;
residualLikelihood?: number | null | undefined;
@@ -34,6 +35,7 @@ export type EditRiskViewUpdateRiskMutation$data = {
readonly inherentImpact: number;
readonly inherentLikelihood: number;
readonly name: string;
readonly note: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
@@ -145,6 +147,13 @@ v2 = [
"name": "treatment",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "note",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -196,16 +205,16 @@ return {
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "a640c5be0a7614478f2d229154d9206a",
"cacheID": "9ae05593d756dd95091353fe5706f8e3",
"id": null,
"metadata": {},
"name": "EditRiskViewUpdateRiskMutation",
"operationKind": "mutation",
"text": "mutation EditRiskViewUpdateRiskMutation(\n $input: UpdateRiskInput!\n) {\n updateRisk(input: $input) {\n risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n updatedAt\n owner {\n id\n fullName\n }\n }\n }\n}\n"
"text": "mutation EditRiskViewUpdateRiskMutation(\n $input: UpdateRiskInput!\n) {\n updateRisk(input: $input) {\n risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n note\n updatedAt\n owner {\n id\n fullName\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "7f4cfbd3d1e3fa396b7ffbcac1e12b0a";
(node as any).hash = "dd20595391e04ea370129e1bf055a5ad";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5b015e6ca9ba83b884026cca65dcdc1c>>
* @generated SignedSource<<98ddd8a7c3387ae45630b80d033bf623>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -16,6 +16,7 @@ export type CreateRiskInput = {
inherentImpact: number;
inherentLikelihood: number;
name: string;
note?: string | null | undefined;
organizationId: string;
ownerId?: string | null | undefined;
residualImpact?: number | null | undefined;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<166b32236b296d1d0a4956cabacb1715>>
* @generated SignedSource<<e318c9e0fe4355eb4923acb54da59ebb>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -46,6 +46,7 @@ export type ShowRiskViewQuery$data = {
}>;
};
readonly name?: string;
readonly note?: string;
readonly owner?: {
readonly fullName: string;
readonly id: string;
@@ -165,31 +166,38 @@ v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"name": "note",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"name": "createdAt",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"name": "updatedAt",
"storageKey": null
},
v14 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"name": "__typename",
"storageKey": null
},
v15 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v16 = {
"alias": null,
"args": null,
"concreteType": "PageInfo",
@@ -214,7 +222,7 @@ v15 = {
],
"storageKey": null
},
v16 = [
v17 = [
{
"alias": null,
"args": null,
@@ -241,7 +249,7 @@ v16 = [
"name": "category",
"storageKey": null
},
(v11/*: any*/),
(v12/*: any*/),
{
"alias": null,
"args": null,
@@ -249,17 +257,17 @@ v16 = [
"name": "state",
"storageKey": null
},
(v13/*: any*/)
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v17 = [
v18 = [
{
"alias": null,
"args": null,
@@ -285,18 +293,18 @@ v17 = [
"name": "status",
"storageKey": null
},
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v18 = [
v19 = [
{
"alias": null,
"args": null,
@@ -323,18 +331,18 @@ v18 = [
},
(v3/*: any*/),
(v4/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v19 = [
v20 = [
{
"kind": "Literal",
"name": "first",
@@ -370,6 +378,7 @@ return {
(v10/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": "mesures",
"args": null,
@@ -377,7 +386,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__mesures_connection",
"plural": false,
"selections": (v16/*: any*/),
"selections": (v17/*: any*/),
"storageKey": null
},
{
@@ -387,7 +396,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__policies_connection",
"plural": false,
"selections": (v17/*: any*/),
"selections": (v18/*: any*/),
"storageKey": null
},
{
@@ -397,7 +406,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__controls_connection",
"plural": false,
"selections": (v18/*: any*/),
"selections": (v19/*: any*/),
"storageKey": null
}
],
@@ -425,7 +434,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v13/*: any*/),
(v14/*: any*/),
(v2/*: any*/),
{
"kind": "InlineFragment",
@@ -440,19 +449,20 @@ return {
(v10/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "MesureConnection",
"kind": "LinkedField",
"name": "mesures",
"plural": false,
"selections": (v16/*: any*/),
"selections": (v17/*: any*/),
"storageKey": "mesures(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__mesures",
@@ -461,17 +471,17 @@ return {
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "PolicyConnection",
"kind": "LinkedField",
"name": "policies",
"plural": false,
"selections": (v17/*: any*/),
"selections": (v18/*: any*/),
"storageKey": "policies(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__policies",
@@ -480,17 +490,17 @@ return {
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "ControlConnection",
"kind": "LinkedField",
"name": "controls",
"plural": false,
"selections": (v18/*: any*/),
"selections": (v19/*: any*/),
"storageKey": "controls(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__controls",
@@ -507,7 +517,7 @@ return {
]
},
"params": {
"cacheID": "b315b57d1b366f87758e300825909da0",
"cacheID": "05f0fe48c916ecda883f606eed0c9244",
"id": null,
"metadata": {
"connection": [
@@ -542,11 +552,11 @@ return {
},
"name": "ShowRiskViewQuery",
"operationKind": "query",
"text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
"text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n note\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "bbb709790492c573d25ee19412956501";
(node as any).hash = "25e67618b61999a955716e937a53a470";
export default node;

View File

@@ -0,0 +1,2 @@
ALTER TABLE risks ADD COLUMN comments TEXT DEFAULT '';
ALTER TABLE risks ALTER COLUMN comments DROP DEFAULT;

View File

@@ -0,0 +1 @@
ALTER TABLE risks RENAME COLUMN comments TO note;

View File

@@ -34,6 +34,7 @@ type (
Description string `db:"description"`
Category string `db:"category"`
Treatment RiskTreatment `db:"treatment"`
Note string `db:"note"`
OwnerID *gid.GID `db:"owner_id"`
InherentLikelihood int `db:"inherent_likelihood"`
InherentImpact int `db:"inherent_impact"`
@@ -80,6 +81,7 @@ WITH rsks AS (
r.category,
r.owner_id,
r.treatment,
r.note,
r.inherent_likelihood,
r.inherent_impact,
r.residual_likelihood,
@@ -101,6 +103,7 @@ SELECT
category,
owner_id,
treatment,
note,
inherent_likelihood,
inherent_impact,
residual_likelihood,
@@ -147,6 +150,7 @@ SELECT
description,
owner_id,
treatment,
note,
inherent_likelihood,
inherent_impact,
residual_likelihood,
@@ -194,6 +198,7 @@ SELECT
category,
owner_id,
treatment,
note,
inherent_likelihood,
inherent_impact,
residual_likelihood,
@@ -231,8 +236,8 @@ func (r *Risk) Insert(
scope Scoper,
) error {
q := `
INSERT INTO risks (id, tenant_id, organization_id, name, description, category, owner_id, treatment, inherent_likelihood, inherent_impact, residual_likelihood, residual_impact, created_at, updated_at)
VALUES (@id, @tenant_id, @organization_id, @name, @description, @category, @owner_id, @treatment, @inherent_likelihood, @inherent_impact, @residual_likelihood, @residual_impact, @created_at, @updated_at)
INSERT INTO risks (id, tenant_id, organization_id, name, description, category, owner_id, treatment, note, inherent_likelihood, inherent_impact, residual_likelihood, residual_impact, created_at, updated_at)
VALUES (@id, @tenant_id, @organization_id, @name, @description, @category, @owner_id, @treatment, @note, @inherent_likelihood, @inherent_impact, @residual_likelihood, @residual_impact, @created_at, @updated_at)
`
args := pgx.StrictNamedArgs{
@@ -244,6 +249,7 @@ VALUES (@id, @tenant_id, @organization_id, @name, @description, @category, @owne
"category": r.Category,
"owner_id": r.OwnerID,
"treatment": r.Treatment,
"note": r.Note,
"inherent_likelihood": r.InherentLikelihood,
"inherent_impact": r.InherentImpact,
"residual_likelihood": r.ResidualLikelihood,
@@ -273,6 +279,7 @@ SET
residual_likelihood = @residual_likelihood,
residual_impact = @residual_impact,
category = @category,
note = @note,
updated_at = @updated_at
WHERE %s
AND id = @risk_id
@@ -286,6 +293,7 @@ WHERE %s
"category": r.Category,
"owner_id": r.OwnerID,
"treatment": r.Treatment,
"note": r.Note,
"inherent_likelihood": r.InherentLikelihood,
"inherent_impact": r.InherentImpact,
"residual_likelihood": r.ResidualLikelihood,

View File

@@ -41,6 +41,7 @@ type (
InherentImpact int
ResidualLikelihood *int
ResidualImpact *int
Note *string
}
UpdateRiskRequest struct {
@@ -54,6 +55,7 @@ type (
InherentImpact *int
ResidualLikelihood *int
ResidualImpact *int
Note *string
}
)
@@ -184,6 +186,10 @@ func (s RiskService) Create(
UpdatedAt: now,
}
if req.Note != nil {
risk.Note = *req.Note
}
if req.ResidualLikelihood != nil {
risk.ResidualLikelihood = *req.ResidualLikelihood
}
@@ -275,6 +281,10 @@ func (s RiskService) Update(
risk.Category = *req.Category
}
if req.Note != nil {
risk.Note = *req.Note
}
risk.UpdatedAt = time.Now()
if err := risk.Update(ctx, conn, s.svc.scope); err != nil {

View File

@@ -678,6 +678,7 @@ type Risk implements Node {
residualLikelihood: Int!
residualImpact: Int!
residualSeverity: Int!
note: String!
owner: People @goField(forceResolver: true)
@@ -1159,6 +1160,7 @@ input CreateRiskInput {
inherentImpact: Int!
residualLikelihood: Int
residualImpact: Int
note: String
}
input UpdateRiskInput {
@@ -1172,6 +1174,7 @@ input UpdateRiskInput {
inherentImpact: Int
residualLikelihood: Int
residualImpact: Int
note: String
}
input DeleteRiskInput {

View File

@@ -448,6 +448,7 @@ type ComplexityRoot struct {
InherentSeverity func(childComplexity int) int
Mesures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MesureOrderBy) int
Name func(childComplexity int) int
Note func(childComplexity int) int
Owner func(childComplexity int) int
Policies func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyOrderBy) int
ResidualImpact func(childComplexity int) int
@@ -2474,6 +2475,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Risk.Name(childComplexity), true
case "Risk.note":
if e.complexity.Risk.Note == nil {
break
}
return e.complexity.Risk.Note(childComplexity), true
case "Risk.owner":
if e.complexity.Risk.Owner == nil {
break
@@ -4062,6 +4070,7 @@ type Risk implements Node {
residualLikelihood: Int!
residualImpact: Int!
residualSeverity: Int!
note: String!
owner: People @goField(forceResolver: true)
@@ -4543,6 +4552,7 @@ input CreateRiskInput {
inherentImpact: Int!
residualLikelihood: Int
residualImpact: Int
note: String
}
input UpdateRiskInput {
@@ -4556,6 +4566,7 @@ input UpdateRiskInput {
inherentImpact: Int
residualLikelihood: Int
residualImpact: Int
note: String
}
input DeleteRiskInput {
@@ -18405,6 +18416,50 @@ func (ec *executionContext) fieldContext_Risk_residualSeverity(_ context.Context
return fc, nil
}
func (ec *executionContext) _Risk_note(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_note(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Note, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Risk_note(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Risk",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Risk_owner(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_owner(ctx, field)
if err != nil {
@@ -18942,6 +18997,8 @@ func (ec *executionContext) fieldContext_RiskEdge_node(_ context.Context, field
return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity":
return ec.fieldContext_Risk_residualSeverity(ctx, field)
case "note":
return ec.fieldContext_Risk_note(ctx, field)
case "owner":
return ec.fieldContext_Risk_owner(ctx, field)
case "mesures":
@@ -20131,6 +20188,8 @@ func (ec *executionContext) fieldContext_UpdateRiskPayload_risk(_ context.Contex
return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity":
return ec.fieldContext_Risk_residualSeverity(ctx, field)
case "note":
return ec.fieldContext_Risk_note(ctx, field)
case "owner":
return ec.fieldContext_Risk_owner(ctx, field)
case "mesures":
@@ -26062,7 +26121,7 @@ func (ec *executionContext) unmarshalInputCreateRiskInput(ctx context.Context, o
asMap[k] = v
}
fieldsInOrder := [...]string{"organizationId", "name", "description", "category", "ownerId", "treatment", "inherentLikelihood", "inherentImpact", "residualLikelihood", "residualImpact"}
fieldsInOrder := [...]string{"organizationId", "name", "description", "category", "ownerId", "treatment", "inherentLikelihood", "inherentImpact", "residualLikelihood", "residualImpact", "note"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -26139,6 +26198,13 @@ func (ec *executionContext) unmarshalInputCreateRiskInput(ctx context.Context, o
return it, err
}
it.ResidualImpact = data
case "note":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("note"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
it.Note = data
}
}
@@ -27668,7 +27734,7 @@ func (ec *executionContext) unmarshalInputUpdateRiskInput(ctx context.Context, o
asMap[k] = v
}
fieldsInOrder := [...]string{"id", "name", "description", "category", "ownerId", "treatment", "inherentLikelihood", "inherentImpact", "residualLikelihood", "residualImpact"}
fieldsInOrder := [...]string{"id", "name", "description", "category", "ownerId", "treatment", "inherentLikelihood", "inherentImpact", "residualLikelihood", "residualImpact", "note"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -27745,6 +27811,13 @@ func (ec *executionContext) unmarshalInputUpdateRiskInput(ctx context.Context, o
return it, err
}
it.ResidualImpact = data
case "note":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("note"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
it.Note = data
}
}
@@ -32067,6 +32140,11 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "note":
out.Values[i] = ec._Risk_note(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "owner":
field := field

View File

@@ -58,5 +58,6 @@ func NewRisk(r *coredata.Risk) *Risk {
Category: r.Category,
CreatedAt: r.CreatedAt,
UpdatedAt: r.UpdatedAt,
Note: r.Note,
}
}

View File

@@ -183,6 +183,7 @@ type CreateRiskInput struct {
InherentImpact int `json:"inherentImpact"`
ResidualLikelihood *int `json:"residualLikelihood,omitempty"`
ResidualImpact *int `json:"residualImpact,omitempty"`
Note *string `json:"note,omitempty"`
}
type CreateRiskMesureMappingInput struct {
@@ -608,6 +609,7 @@ type Risk struct {
ResidualLikelihood int `json:"residualLikelihood"`
ResidualImpact int `json:"residualImpact"`
ResidualSeverity int `json:"residualSeverity"`
Note string `json:"note"`
Owner *People `json:"owner,omitempty"`
Mesures *MesureConnection `json:"mesures"`
Policies *PolicyConnection `json:"policies"`
@@ -736,6 +738,7 @@ type UpdateRiskInput struct {
InherentImpact *int `json:"inherentImpact,omitempty"`
ResidualLikelihood *int `json:"residualLikelihood,omitempty"`
ResidualImpact *int `json:"residualImpact,omitempty"`
Note *string `json:"note,omitempty"`
}
type UpdateRiskPayload struct {

View File

@@ -749,6 +749,7 @@ func (r *mutationResolver) CreateRisk(ctx context.Context, input types.CreateRis
InherentImpact: input.InherentImpact,
ResidualLikelihood: input.ResidualLikelihood,
ResidualImpact: input.ResidualImpact,
Note: input.Note,
},
)
if err != nil {
@@ -777,6 +778,7 @@ func (r *mutationResolver) UpdateRisk(ctx context.Context, input types.UpdateRis
InherentImpact: input.InherentImpact,
ResidualLikelihood: input.ResidualLikelihood,
ResidualImpact: input.ResidualImpact,
Note: input.Note,
},
)
if err != nil {