mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: change HTTP methods from PUT to GET for association and unassociation endpoints
This commit is contained in:
parent
6f81d80389
commit
f21d301140
|
|
@ -201,14 +201,14 @@ class UnAssociationAPI(APIMixin):
|
|||
name="paragraph_id",
|
||||
description="段落id",
|
||||
type=OpenApiTypes.STR,
|
||||
location='path',
|
||||
location='query',
|
||||
required=True,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="problem_id",
|
||||
description="问题id",
|
||||
type=OpenApiTypes.STR,
|
||||
location='path',
|
||||
location='query',
|
||||
required=True,
|
||||
)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ urlpatterns = [
|
|||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph', views.ParagraphView.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/batch_delete', views.ParagraphView.BatchDelete.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/batch_generate_related', views.ParagraphView.BatchGenerateRelated.as_view()),
|
||||
path( 'workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/association', views.ParagraphView.Association.as_view()),
|
||||
path( 'workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/unassociation', views.ParagraphView.UnAssociation.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/<str:paragraph_id>', views.ParagraphView.Operate.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/<str:paragraph_id>/problem', views.ParagraphView.Problem.as_view()),
|
||||
path( 'workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/<int:current_page>/<int:page_size>', views.ParagraphView.Page.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/<str:paragraph_id>/problem/<str:problem_id>/association', views.ParagraphView.Association.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/document/<str:document_id>/paragraph/<str:paragraph_id>/problem/<str:problem_id>/unassociation', views.ParagraphView.UnAssociation.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/problem', views.ProblemView.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/problem/batch_delete', views.ProblemView.BatchDelete.as_view()),
|
||||
path('workspace/<str:workspace_id>/knowledge/<str:knowledge_id>/problem/batch_association', views.ProblemView.BatchAssociation.as_view()),
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ class ParagraphView(APIView):
|
|||
authentication_classes = [TokenAuth]
|
||||
|
||||
@extend_schema(
|
||||
methods=['PUT'],
|
||||
methods=['GET'],
|
||||
summary=_('Disassociation issue'),
|
||||
description=_('Disassociation issue'),
|
||||
operation_id=_('Disassociation issue'), # type: ignore
|
||||
|
|
@ -216,15 +216,14 @@ class ParagraphView(APIView):
|
|||
tags=[_('Knowledge Base/Documentation/Paragraph')] # type: ignore
|
||||
)
|
||||
@has_permissions(PermissionConstants.DOCUMENT_EDIT.get_workspace_permission())
|
||||
def put(self, request: Request,
|
||||
workspace_id: str, knowledge_id: str, document_id: str, paragraph_id: str, problem_id: str):
|
||||
def get(self, request: Request, workspace_id: str, knowledge_id: str, document_id: str):
|
||||
return result.success(ParagraphSerializers.Association(
|
||||
data={
|
||||
'workspace_id': workspace_id,
|
||||
'knowledge_id': knowledge_id,
|
||||
'document_id': document_id,
|
||||
'paragraph_id': paragraph_id,
|
||||
'problem_id': problem_id
|
||||
'paragraph_id': request.query_params.get('paragraph_id'),
|
||||
'problem_id': request.query_params.get('problem_id')
|
||||
}
|
||||
).un_association())
|
||||
|
||||
|
|
@ -232,7 +231,7 @@ class ParagraphView(APIView):
|
|||
authentication_classes = [TokenAuth]
|
||||
|
||||
@extend_schema(
|
||||
methods=['PUT'],
|
||||
methods=['GET'],
|
||||
summary=_('Related questions'),
|
||||
description=_('Related questions'),
|
||||
operation_id=_('Related questions'), # type: ignore
|
||||
|
|
@ -241,15 +240,14 @@ class ParagraphView(APIView):
|
|||
tags=[_('Knowledge Base/Documentation/Paragraph')] # type: ignore
|
||||
)
|
||||
@has_permissions(PermissionConstants.DOCUMENT_EDIT.get_workspace_permission())
|
||||
def put(self, request: Request,
|
||||
workspace_id: str, knowledge_id: str, document_id: str, paragraph_id: str, problem_id: str):
|
||||
def get(self, request: Request, workspace_id: str, knowledge_id: str, document_id: str):
|
||||
return result.success(ParagraphSerializers.Association(
|
||||
data={
|
||||
'workspace_id': workspace_id,
|
||||
'knowledge_id': knowledge_id,
|
||||
'document_id': document_id,
|
||||
'paragraph_id': paragraph_id,
|
||||
'problem_id': problem_id
|
||||
'paragraph_id': request.query_params.get('paragraph_id'),
|
||||
'problem_id': request.query_params.get('problem_id')
|
||||
}
|
||||
).association())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue