def delete(self, req, team_id, *args, **kwargs): try: team_services.delete_by_tenant_id(self.user, self.team) return Response(None, status.HTTP_200_OK) except Tenants.DoesNotExist as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND) except PermRelTenant as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND)
def delete(self, request, team_name, *args, **kwargs): """ 删除当前团队 --- parameters: - name: team_name description: 要删除的团队 required: true type: string paramType: path """ tenant = team_services.get_enterprise_tenant_by_tenant_name( enterprise_id=self.enterprise.enterprise_id, tenant_name=team_name) if tenant is None: result = general_message(404, "tenant not exist", "{}团队不存在".format(team_name)) else: team_services.delete_by_tenant_id(self.user, tenant) result = general_message(200, "delete a tenant successfully", "删除团队成功") return Response(result, status=result["code"])
def delete(self, req, team_id, *args, **kwargs): try: res = team_services.delete_by_tenant_id(tenant_id=team_id) if res: return Response(None, status.HTTP_200_OK) else: return Response(None, status=status.HTTP_500_INTERNAL_SERVER_ERROR) except Tenants.DoesNotExist as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND) except PermRelTenant as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND)
def delete(self, req, team_id, *args, **kwargs): try: service_count = team_services.count_by_tenant_id(tenant_id=team_id) if service_count >= 1: raise serializers.ValidationError("当前团队内有应用,不可以删除") res = team_services.delete_by_tenant_id(tenant_id=team_id) if res: return Response(None, status.HTTP_200_OK) else: return Response(None, status=status.HTTP_500_INTERNAL_SERVER_ERROR) except Tenants.DoesNotExist as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND) except PermRelTenant as e: logger.exception("failed to delete tenant: {}".format(e.message)) return Response(None, status=status.HTTP_404_NOT_FOUND)