Skip to content

Commit

Permalink
Merge pull request #778 from hinashi/fixed/entry_history_apiv2
Browse files Browse the repository at this point in the history
Fixed entry history API for openapi generator
  • Loading branch information
userlocalhost authored Feb 22, 2023
2 parents 943f465 + d1ec60d commit 8d2db52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion entry/api_v2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"<int:pk>/histories/",
views.EntryAPI.as_view(
{
"get": "histories",
"get": "list",
}
),
),
Expand Down
9 changes: 5 additions & 4 deletions entry/api_v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def has_object_permission(self, request, view, obj):
"destroy": ACLType.Writable,
"restore": ACLType.Writable,
"copy": ACLType.Writable,
"histories": ACLType.Readable,
"list": ACLType.Readable, # histories
}

if not user.has_permission(obj, permisson.get(view.action)):
Expand All @@ -70,7 +70,7 @@ def get_serializer_class(self):
"retrieve": EntryRetrieveSerializer,
"update": EntryUpdateSerializer,
"copy": EntryCopySerializer,
"histories": EntryHistoryAttributeValueSerializer,
"list": EntryHistoryAttributeValueSerializer,
}
return serializer.get(self.action, EntryBaseSerializer)

Expand Down Expand Up @@ -155,7 +155,8 @@ def copy(self, request, pk):

return Response({}, status=status.HTTP_200_OK)

def histories(self, request, pk):
# histories view
def list(self, request, pk):
user: User = self.request.user
entry: Entry = self.get_object()

Expand All @@ -174,7 +175,7 @@ def histories(self, request, pk):
.select_related("parent_attr")
)

return self.list(request, pk)
return super(EntryAPI, self).list(request, pk)


@extend_schema(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.openapi-generator-ignore
apis/AclApi.ts
apis/EntityApi.ts
apis/EntryApi.ts
Expand Down

0 comments on commit 8d2db52

Please sign in to comment.