added Mark All As Read action to notification

pull/122/MERGE
13621160019@163.com 2022-02-17 18:54:54 +08:00
parent 73c5a990a9
commit 93f9641d8b
2 changed files with 82 additions and 14 deletions

View File

@ -9655,6 +9655,74 @@
},
"response": []
},
{
"name": "PUT Update All New Web Messages (Mark All As Read)",
"request": {
"method": "PUT",
"header": [
{
"key": "User-UUID",
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
"type": "text",
"description": "Any admin users' UUID"
},
{
"key": "Token",
"value": "597881540b33791a032b95aa48e0de098dc95ec0b813edd8a92cee87ee5eed1b8db7856a047ed06324c333bf2c98f0c7613e346ae25d1bcae3994f30b4562dfb",
"type": "text",
"description": "Login to get a valid token"
}
],
"body": {
"mode": "raw",
"raw": "{\"data\":{\"status\":\"read\"}}"
},
"url": {
"raw": "{{base_url}}/webmessagesnew",
"host": [
"{{base_url}}"
],
"path": [
"webmessagesnew"
]
}
},
"response": []
},
{
"name": "PUT Update All New Web Messages (Acknowledge All)",
"request": {
"method": "PUT",
"header": [
{
"key": "User-UUID",
"value": "dcdb67d1-6116-4987-916f-6fc6cf2bc0e4",
"type": "text",
"description": "Any admin users' UUID"
},
{
"key": "Token",
"value": "597881540b33791a032b95aa48e0de098dc95ec0b813edd8a92cee87ee5eed1b8db7856a047ed06324c333bf2c98f0c7613e346ae25d1bcae3994f30b4562dfb",
"type": "text",
"description": "Login to get a valid token"
}
],
"body": {
"mode": "raw",
"raw": "{\"data\":{\"status\":\"acknowledged\", \"reply\":\"OK\"}}"
},
"url": {
"raw": "{{base_url}}/webmessagesnew",
"host": [
"{{base_url}}"
],
"path": [
"webmessagesnew"
]
}
},
"response": []
},
{
"name": "GET a Web Message by ID",
"request": {

View File

@ -265,13 +265,13 @@ class WebMessageStatusNewCollection:
status = str.strip(new_values['data']['status'])
# reply is required for 'acknowledged' status
if status == 'acknowledged' and \
('reply' not in new_values['data'].keys() or
not isinstance(new_values['data']['reply'], str) or
len(str.strip(new_values['data']['reply'])) == 0):
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_REPLY')
reply = str.strip(new_values['data']['reply'])
if status == 'acknowledged':
if 'reply' not in new_values['data'].keys() or \
not isinstance(new_values['data']['reply'], str) or \
len(str.strip(new_values['data']['reply'])) == 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_REPLY')
else:
reply = str.strip(new_values['data']['reply'])
else:
reply = None
@ -485,13 +485,13 @@ class WebMessageItem:
status = str.strip(new_values['data']['status'])
# reply is required for 'acknowledged' status
if status == 'acknowledged' and \
('reply' not in new_values['data'].keys() or
not isinstance(new_values['data']['reply'], str) or
len(str.strip(new_values['data']['reply'])) == 0):
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_REPLY')
reply = str.strip(new_values['data']['reply'])
if status == 'acknowledged':
if 'reply' not in new_values['data'].keys() or \
not isinstance(new_values['data']['reply'], str) or \
len(str.strip(new_values['data']['reply'])) == 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_REPLY')
else:
reply = str.strip(new_values['data']['reply'])
else:
reply = None