From 61761fedc5ffdf435f66b3fc5ce8ba331f5175bc Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:15:38 +0530 Subject: [PATCH] chore: remove view filter validation while creating or updating view (#836) --- apiserver/plane/api/serializers/view.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/apiserver/plane/api/serializers/view.py b/apiserver/plane/api/serializers/view.py index 021bcfb72..076228ae0 100644 --- a/apiserver/plane/api/serializers/view.py +++ b/apiserver/plane/api/serializers/view.py @@ -25,22 +25,18 @@ class IssueViewSerializer(BaseSerializer): def create(self, validated_data): query_params = validated_data.get("query_data", {}) - - if not bool(query_params): - raise serializers.ValidationError( - {"query_data": ["Query data field cannot be empty"]} - ) - - validated_data["query"] = issue_filters(query_params, "POST") + if bool(query_params): + validated_data["query"] = issue_filters(query_params, "POST") + else: + validated_data["query"] = dict() return IssueView.objects.create(**validated_data) def update(self, instance, validated_data): query_params = validated_data.get("query_data", {}) - if not bool(query_params): - raise serializers.ValidationError( - {"query_data": ["Query data field cannot be empty"]} - ) - + if bool(query_params): + validated_data["query"] = issue_filters(query_params, "POST") + else: + validated_data["query"] = dict() validated_data["query"] = issue_filters(query_params, "PATCH") return super().update(instance, validated_data)