Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risk assessment page improvement (edit) #1025

Merged
merged 14 commits into from
Nov 16, 2024
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
Loading