Skip to content
Snippets Groups Projects
Commit 6773ed99 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-207: added various convenience meta methods and REST actions to create...

TMSS-207: added various convenience meta methods and REST actions to create and/or schedule the subtasks from the TaskBlueprint, TaskDraft, SchedulingUnitBlueprint or SchedulingUnitDraft
parent de457f4b
No related branches found
No related tags found
1 merge request!162Intermediate merge of TMSS-207 to master
......@@ -218,6 +218,18 @@ class SchedulingUnitBlueprintViewSet(LOFARViewSet):
queryset = models.SchedulingUnitBlueprint.objects.all()
serializer_class = serializers.SchedulingUnitBlueprintSerializer
@swagger_auto_schema(responses={201: "This SchedulingUnitBlueprint, with references to it's created TaskBlueprints.",
403: 'forbidden'},
operation_description="Create TaskBlueprint(s) for this scheduling unit, create subtasks, and schedule the ones that are not dependend on predecessors.")
@action(methods=['get'], detail=True, url_name="create_taskblueprints_and_schedule", name="Create TaskBlueprints, Subtask(s) and Schedule")
def create_taskblueprints_and_schedule(self, request, pk=None):
scheduling_unit_blueprint = get_object_or_404(models.SchedulingUnitBlueprint, pk=pk)
scheduling_unit_blueprint = create_task_blueprints_and_subtasks_and_schedule_subtasks_from_scheduling_unit_blueprint(scheduling_unit_blueprint)
# return a response with the new serialized scheduling_unit_blueprint (with references to the created task_blueprint(s) and (scheduled) subtasks)
return Response(serializers.SchedulingUnitBlueprintSerializer(scheduling_unit_blueprint, context={'request':request}).data,
status=status.HTTP_201_CREATED)
class SchedulingUnitBlueprintNestedViewSet(LOFARNestedViewSet):
queryset = models.SchedulingUnitBlueprint.objects.all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment