Skip to content

Commit

Permalink
Risk assessment page improvement (edit) (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith authored Nov 16, 2024
2 parents 360f032 + 1cb4ff1 commit 0ea280c
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.1.1 on 2024-11-09 08:49

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0034_fix_loaded_libraries_objects_meta"),
]

operations = [
migrations.AddField(
model_name="riskscenario",
name="existing_applied_controls",
field=models.ManyToManyField(
blank=True,
related_name="risk_scenarios_e",
to="core.appliedcontrol",
verbose_name="Existing Applied controls",
),
),
]
6 changes: 6 additions & 0 deletions backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,12 @@ class RiskScenario(NameDescriptionMixin):
verbose_name=_("Existing controls"),
blank=True,
)
existing_applied_controls = models.ManyToManyField(
AppliedControl,
verbose_name=_("Existing Applied controls"),
blank=True,
related_name="risk_scenarios_e",
)

owner = models.ManyToManyField(
User,
Expand Down
1 change: 1 addition & 0 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ class RiskScenarioReadSerializer(RiskScenarioWriteSerializer):
strength_of_knowledge = serializers.JSONField(source="get_strength_of_knowledge")

applied_controls = FieldsRelatedField(many=True)
existing_applied_controls = FieldsRelatedField(many=True)
rid = serializers.CharField()

owner = FieldsRelatedField(many=True)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const ThreatSchema = baseNamedObject({
export const RiskScenarioSchema = baseNamedObject({
existing_controls: z.string().optional(),
applied_controls: z.string().uuid().optional().array().optional(),
existing_applied_controls: z.string().uuid().optional().array().optional(),
current_proba: z.number().optional(),
current_impact: z.number().optional(),
residual_proba: z.number().optional(),
Expand Down
Loading

0 comments on commit 0ea280c

Please sign in to comment.