Skip to content

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

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

Merged
Show file tree
Hide file tree
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
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
Loading