Browse Source

fix: update MessageService.create_feedback to use keyword arguments f… (#12134)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/0.15.0
-LAN- 10 months ago
parent
commit
4bd8df1fd3
No account linked to committer's email address

+ 8
- 1
api/controllers/console/explore/message.py View File



parser = reqparse.RequestParser() parser = reqparse.RequestParser()
parser.add_argument("rating", type=str, choices=["like", "dislike", None], location="json") parser.add_argument("rating", type=str, choices=["like", "dislike", None], location="json")
parser.add_argument("content", type=str, location="json")
args = parser.parse_args() args = parser.parse_args()


try: try:
MessageService.create_feedback(app_model, message_id, current_user, args.get("rating"), args.get("content"))
MessageService.create_feedback(
app_model=app_model,
message_id=message_id,
user=current_user,
rating=args.get("rating"),
content=args.get("content"),
)
except services.errors.message.MessageNotExistsError: except services.errors.message.MessageNotExistsError:
raise NotFound("Message Not Exists.") raise NotFound("Message Not Exists.")



+ 7
- 1
api/controllers/service_api/app/message.py View File

args = parser.parse_args() args = parser.parse_args()


try: try:
MessageService.create_feedback(app_model, message_id, end_user, args.get("rating"), args.get("content"))
MessageService.create_feedback(
app_model=app_model,
message_id=message_id,
user=end_user,
rating=args.get("rating"),
content=args.get("content"),
)
except services.errors.message.MessageNotExistsError: except services.errors.message.MessageNotExistsError:
raise NotFound("Message Not Exists.") raise NotFound("Message Not Exists.")



+ 1
- 0
api/services/message_service.py View File

@classmethod @classmethod
def create_feedback( def create_feedback(
cls, cls,
*,
app_model: App, app_model: App,
message_id: str, message_id: str,
user: Optional[Union[Account, EndUser]], user: Optional[Union[Account, EndUser]],

Loading…
Cancel
Save