Skip to content

Commit

Permalink
fix: update MessageService.create_feedback to use keyword arguments f… (
Browse files Browse the repository at this point in the history
#12134)

Signed-off-by: -LAN- <[email protected]>
  • Loading branch information
laipz8200 authored Dec 26, 2024
1 parent 4e76f2f commit 4bd8df1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion api/controllers/console/explore/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ def post(self, installed_app, message_id):

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

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:
raise NotFound("Message Not Exists.")

Expand Down
8 changes: 7 additions & 1 deletion api/controllers/service_api/app/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ def post(self, app_model: App, end_user: EndUser, message_id):
args = parser.parse_args()

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:
raise NotFound("Message Not Exists.")

Expand Down
1 change: 1 addition & 0 deletions api/services/message_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def pagination_by_last_id(
@classmethod
def create_feedback(
cls,
*,
app_model: App,
message_id: str,
user: Optional[Union[Account, EndUser]],
Expand Down

0 comments on commit 4bd8df1

Please sign in to comment.