Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

补充工单日志接口校验 #1887

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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