-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Search application chat log by user #3923
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ class ApplicationChatRecordExportRequest(serializers.Serializer): | |
| class ApplicationChatQuerySerializers(serializers.Serializer): | ||
| workspace_id = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_("Workspace ID")) | ||
| abstract = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_("summary")) | ||
| username = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_("username")) | ||
| start_time = serializers.DateField(format='%Y-%m-%d', label=_("Start time")) | ||
| end_time = serializers.DateField(format='%Y-%m-%d', label=_("End time")) | ||
| application_id = serializers.UUIDField(required=True, label=_("Application ID")) | ||
|
|
@@ -86,6 +87,7 @@ def get_query_set(self, select_ids=None): | |
| query_set = QuerySet(model=get_dynamics_model( | ||
| {'application_chat.application_id': models.CharField(), | ||
| 'application_chat.abstract': models.CharField(), | ||
| 'application_chat.asker': models.JSONField(), | ||
| "star_num": models.IntegerField(), | ||
| 'trample_num': models.IntegerField(), | ||
| 'comparer': models.CharField(), | ||
|
|
@@ -98,6 +100,9 @@ def get_query_set(self, select_ids=None): | |
| } | ||
| if 'abstract' in self.data and self.data.get('abstract') is not None: | ||
| base_query_dict['application_chat.abstract__icontains'] = self.data.get('abstract') | ||
| if 'username' in self.data and self.data.get('username') is not None: | ||
| base_query_dict['application_chat.asker__username'] = self.data.get('username') | ||
|
|
||
|
|
||
| if select_ids is not None and len(select_ids) > 0: | ||
| base_query_dict['application_chat.id__in'] = select_ids | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review and Optimizations
By addressing these points, you can enhance the security and efficiency of your application chat query serialization process. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code snippet appears to be from an OpenAPI schema definition used in web frameworks like FastAPI or Django REST Framework. Here's a quick review:
Irregularity/Suggestion #1: Redundant Field
usernamefield is described twice with the same parameters (type, etc.). This can be reduced.Suggestion #2: Typographical Corrections
_and"syntax errors. Replace_with the appropriate import for translations (if needed), and ensure correct quotation marks.Suggestion #3: Improved Documentation Quality
Enhance the comments and descriptions where possible to improve clarity.
@@ -65,9 +65,9 @@
type=OpenApiTypes.STR, # Username parameter
required=False,
),
@@ -70,7 +70,8 @@
type=OpenApiTypes.INT, # Minimum number of likes
required=True,
),
@@ -75,7 +76,7 @@
"required": [
@@ -82,9 +83,10 @@
]
}