Skip to content

Commit

Permalink
fix(word): validate word id in WD0601 (#335)
Browse files Browse the repository at this point in the history
* fix(word): fix a bug in WD0601

解决词单创建报错但实际创建成功

Closes #331
  • Loading branch information
CapooL authored Nov 5, 2023
1 parent 7a45514 commit 6dfcbb8
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 96 deletions.
2 changes: 2 additions & 0 deletions hinghwa-dict-backend/word/lists/view/manage_all_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def post(self, request):
list_form = ListForm(body)
if not list_form.is_valid():
raise BadRequestException()
for id in body["words"]:
word = Word.objects.get(id=id)
list = list_form.save(commit=False)
list.createTime = timezone.now()
list.updateTime = timezone.now()
Expand Down
1 change: 0 additions & 1 deletion tests/pronunciation-PN0102-200.apifox-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@
"pronunciation",
"pronunciation_uploaded",
"word",
"listened",
"word_uploaded"
],
"x-apifox-orders": [
Expand Down
12 changes: 1 addition & 11 deletions tests/pronunciation-PN0205-200.apifox-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -1623,29 +1623,19 @@
},
"title": "上传词语",
"description": "上传词语数量"
},
"listened": {
"type": "integer",
"mock": {
"mock": "@integer"
},
"title": "",
"description": "上传语音被播放的量"
}
},
"required": [
"pronunciation",
"pronunciation_uploaded",
"word",
"listened",
"word_uploaded"
],
"x-apifox-orders": [
"pronunciation",
"pronunciation_uploaded",
"word",
"word_uploaded",
"listened"
"word_uploaded"
]
},
"notification": {
Expand Down
Loading

0 comments on commit 6dfcbb8

Please sign in to comment.