mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-10-21 07:09:30 +02:00
Implement archived bookmarks endpoint (#46)
This commit is contained in:
10
API.md
10
API.md
@@ -59,6 +59,16 @@ Example response:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Archived**
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/bookmarks/archived/
|
||||||
|
```
|
||||||
|
|
||||||
|
List archived bookmarks.
|
||||||
|
|
||||||
|
Parameters and response are the same as for the regular list endpoint.
|
||||||
|
|
||||||
**Retrieve**
|
**Retrieve**
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
from rest_framework import viewsets, mixins
|
from rest_framework import viewsets, mixins, status
|
||||||
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
from bookmarks import queries
|
from bookmarks import queries
|
||||||
@@ -27,6 +29,16 @@ class BookmarkViewSet(viewsets.GenericViewSet,
|
|||||||
def get_serializer_context(self):
|
def get_serializer_context(self):
|
||||||
return {'user': self.request.user}
|
return {'user': self.request.user}
|
||||||
|
|
||||||
|
@action(methods=['get'], detail=False)
|
||||||
|
def archived(self, request):
|
||||||
|
user = request.user
|
||||||
|
query_string = request.GET.get('q')
|
||||||
|
query_set = queries.query_archived_bookmarks(user, query_string)
|
||||||
|
page = self.paginate_queryset(query_set)
|
||||||
|
serializer = self.get_serializer_class()
|
||||||
|
data = serializer(page, many=True).data
|
||||||
|
return self.get_paginated_response(data)
|
||||||
|
|
||||||
|
|
||||||
class TagViewSet(viewsets.GenericViewSet,
|
class TagViewSet(viewsets.GenericViewSet,
|
||||||
mixins.ListModelMixin,
|
mixins.ListModelMixin,
|
||||||
|
Reference in New Issue
Block a user