Skip to content

Commit

Permalink
V1 Mapping | delete api
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Apr 13, 2021
1 parent 9e18de7 commit 4aa64a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/v1_importers/urls.py
Expand Up @@ -28,4 +28,5 @@
),
path('tokens/', views.UserTokensImporterView.as_view(), name='v1-tokens-import'),
path('concept/', views.ConceptView.as_view(), name='v1-concept'),
path('mapping/', views.MappingView.as_view(), name='v1-mapping'),
]
13 changes: 13 additions & 0 deletions core/v1_importers/views.py
Expand Up @@ -136,3 +136,16 @@ def delete(self, _):
concept.delete()

return Response(status=status.HTTP_204_NO_CONTENT)


class MappingView(APIView):
def delete(self, _):
uris = self.request.data.get('uris', [])
if not isinstance(uris, list):
return Response(status=status.HTTP_400_BAD_REQUEST)

from core.mappings.models import Mapping
for concept in Mapping.objects.filter(uri__in=uris):
concept.delete()

return Response(status=status.HTTP_204_NO_CONTENT)

0 comments on commit 4aa64a6

Please sign in to comment.