Skip to content

Commit

Permalink
补充工单日志接口校验 (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick2wang authored Sep 28, 2022
1 parent bb7144c commit bf809ce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sql_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,19 @@ class WorkflowLogSerializer(serializers.Serializer):
choices=[1, 2, 3], label="工单类型:1-查询权限申请,2-SQL上线申请,3-数据归档申请"
)

def validate(self, attrs):
workflow_id = attrs.get("workflow_id")
workflow_type = attrs.get("workflow_type")

try:
WorkflowAudit.objects.get(
workflow_id=workflow_id, workflow_type=workflow_type
)
except WorkflowAudit.DoesNotExist:
raise serializers.ValidationError({"errors": "不存在该工单"})

return attrs


class WorkflowLogListSerializer(serializers.ModelSerializer):
class Meta:
Expand Down

0 comments on commit bf809ce

Please sign in to comment.