Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions FusionIIIT/applications/iwdModuleV2/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
path('audit-document-view/', views.audit_document_view, name='auditDocumentView'),
path('audit-document/', views.handle_audit_document, name='auditDocument'),
path('get-proposals/', views.get_proposals, name='getProposals'),
path('get-items/', views.get_items, name='getItems'),


# partially integrated on frontend
path('handle-process-bills/', views.handle_process_bills, name='handleProcessedBills'),
Expand Down
11 changes: 11 additions & 0 deletions FusionIIIT/applications/iwdModuleV2/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,3 +1223,14 @@ def get_proposals(request):
return Response(serializer.data, status=status.HTTP_200_OK)


@api_view(['GET'])
@permission_classes([IsAuthenticated])
def get_items(request):
try:
data = request.data
proposal = Proposal.objects.get(id=data['proposal_id'])
items = Item.objects.filter(proposal=proposal)
serializer = ItemSerializer(items, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
except Proposal.DoesNotExist:
return Response({'error': 'Proposal not found'}, status=status.HTTP_404_NOT_FOUND)