Skip to content

Commit

Permalink
Merge branch '#438-identifier-assignment' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
RichGriff committed Jun 17, 2024
2 parents e2f1f13 + 5a20ee0 commit 98d6e41
Show file tree
Hide file tree
Showing 20 changed files with 422 additions and 78 deletions.
23 changes: 23 additions & 0 deletions eap_backend/eap_api/migrations/0016_auto_20240613_1028.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.8 on 2024-06-13 10:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('eap_api', '0015_githubrepository'),
]

operations = [
migrations.AlterField(
model_name='strategy',
name='long_description',
field=models.CharField(max_length=3000),
),
migrations.AlterField(
model_name='strategy',
name='short_description',
field=models.CharField(max_length=1000),
),
]
34 changes: 28 additions & 6 deletions eap_backend/eap_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ class EAPGroupSerializer(serializers.ModelSerializer):
owner_id = serializers.PrimaryKeyRelatedField(
source="owner", queryset=EAPUser.objects.all()
)
viewable_cases = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
editable_cases = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
viewable_cases = serializers.PrimaryKeyRelatedField(
many=True, read_only=True
)
editable_cases = serializers.PrimaryKeyRelatedField(
many=True, read_only=True
)

class Meta:
model = EAPGroup
Expand Down Expand Up @@ -131,9 +135,13 @@ class TopLevelNormativeGoalSerializer(serializers.ModelSerializer):
source="assurance_case", queryset=AssuranceCase.objects.all()
)
context = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
property_claims = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
property_claims = serializers.PrimaryKeyRelatedField(
many=True, read_only=True
)
strategies = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
type = serializers.CharField(default="TopLevelNormativeGoal", read_only=True)
type = serializers.CharField(
default="TopLevelNormativeGoal", read_only=True
)

class Meta:
model = TopLevelNormativeGoal
Expand All @@ -150,6 +158,8 @@ class Meta:
"strategies",
)

extra_kwargs = {"name": {"allow_null": True, "required": False}}


class ContextSerializer(serializers.ModelSerializer):
goal_id = serializers.PrimaryKeyRelatedField(
Expand All @@ -169,6 +179,8 @@ class Meta:
"goal_id",
)

extra_kwargs = {"name": {"allow_null": True, "required": False}}


class PropertyClaimSerializer(serializers.ModelSerializer):
goal_id = serializers.PrimaryKeyRelatedField(
Expand All @@ -189,7 +201,9 @@ class PropertyClaimSerializer(serializers.ModelSerializer):

level = serializers.IntegerField(read_only=True)
claim_type = serializers.CharField(default="Project claim")
property_claims = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
property_claims = serializers.PrimaryKeyRelatedField(
many=True, read_only=True
)

# Use SerializerMethodField to handle the possibility of property_claim being None
evidence = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
Expand All @@ -212,6 +226,8 @@ class Meta:
"strategy_id",
)

extra_kwargs = {"name": {"allow_null": True, "required": False}}


class EvidenceSerializer(serializers.ModelSerializer):
property_claim_id = serializers.PrimaryKeyRelatedField(
Expand All @@ -233,6 +249,8 @@ class Meta:
"property_claim_id",
)

extra_kwargs = {"name": {"allow_null": True, "required": False}}


class StrategySerializer(serializers.ModelSerializer):
goal_id = serializers.PrimaryKeyRelatedField(
Expand All @@ -241,7 +259,9 @@ class StrategySerializer(serializers.ModelSerializer):
required=False,
)

property_claims = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
property_claims = serializers.PrimaryKeyRelatedField(
many=True, read_only=True
)

class Meta:
model = Strategy
Expand All @@ -253,3 +273,5 @@ class Meta:
"goal_id",
"property_claims",
)

extra_kwargs = {"name": {"allow_null": True, "required": False}}
20 changes: 16 additions & 4 deletions eap_backend/eap_api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@
path("goals/<int:pk>/", views.goal_detail, name="goal_detail"),
path("contexts/", views.context_list, name="context_list"),
path("contexts/<int:pk>/", views.context_detail, name="context_detail"),
path("propertyclaims/", views.property_claim_list, name="property_claim_list"),
path("comments/<int:assurance_case_id>/", views.comment_list, name="comment_list"),
path(
"propertyclaims/",
views.property_claim_list,
name="property_claim_list",
),
path(
"comments/<int:assurance_case_id>/",
views.comment_list,
name="comment_list",
),
path(
"comments/<int:comment_id>/reply/",
views.reply_to_comment,
Expand All @@ -38,9 +46,13 @@
views.parents,
name="parents",
),
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
path(
"api-auth/", include("rest_framework.urls", namespace="rest_framework")
),
path("strategies/", views.strategies_list, name="strategies_list"),
path("strategies/<int:pk>/", views.strategy_detail, name="strategy_detail"),
path(
"strategies/<int:pk>/", views.strategy_detail, name="strategy_detail"
),
path("auth/github/", views.GithubSocialAuthView.as_view()),
path(
"users/<int:pk>/github_repositories/",
Expand Down
Loading

0 comments on commit 98d6e41

Please sign in to comment.