| 974 | responses={200: inline_serializer(name="RepoDeleteSuccess", fields={"success": serializers.BooleanField()}), 404: inline_serializer(name="RepoDeleteNotFound", fields={"error": serializers.CharField()})}, |
| 975 | ) |
| 976 | def delete(self, request, pk): |
| 977 | try: |
| 978 | repo = PluginRepo.objects.get(pk=pk) |
| 979 | except PluginRepo.DoesNotExist: |
| 980 | return Response( |
| 981 | {"error": "Repo not found"}, status=status.HTTP_404_NOT_FOUND |
| 982 | ) |
| 983 | if repo.is_official: |
| 984 | return Response( |
| 985 | {"error": "Cannot delete the official repository"}, |
| 986 | status=status.HTTP_400_BAD_REQUEST, |
| 987 | ) |
| 988 | repo.delete() |
| 989 | return Response({"success": True}) |
| 990 | |
| 991 | |
| 992 | class PluginRepoRefreshAPIView(PluginAuthMixin, APIView): |