Skip to content
Draft
Show file tree
Hide file tree
Changes from 9 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
8 changes: 4 additions & 4 deletions jsapp/js/api/models/assetUsageListParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ The endpoints are grouped by area of intended use. Each category contains relate

export type AssetUsageListParams = {
/**
* A page number within the paginated result set.
* Number of results to return per page.
*/
page?: number
limit?: number
/**
* Number of results to return per page.
* The initial index from which to return the results.
*/
page_size?: number
offset?: number
}
8 changes: 0 additions & 8 deletions kpi/paginators.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ def get_paginated_response_schema(self, schema):
}


class AssetUsagePagination(PageNumberPagination):
"""
Pagination class for usage project breakdown table.
"""
page_size = 8
page_size_query_param = 'page_size'


class DataPagination(LimitOffsetPagination):
"""
Pagination class for submissions.
Expand Down
2 changes: 0 additions & 2 deletions kpi/views/v2/asset_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from rest_framework.mixins import ListModelMixin

from kpi.models.asset import Asset
from kpi.paginators import AssetUsagePagination
from kpi.permissions import IsAuthenticated
from kpi.schema_extensions.v2.asset_usage.serializers import AssetUsageResponse
from kpi.serializers.v2.service_usage import AssetUsageSerializer
Expand Down Expand Up @@ -35,7 +34,6 @@ class AssetUsageViewSet(ListModelMixin, viewsets.GenericViewSet):

permission_classes = (IsAuthenticated,)
serializer_class = AssetUsageSerializer
pagination_class = AssetUsagePagination

def get_queryset(self):
return Asset.objects.defer('content').filter(owner=self.request.user)
12 changes: 6 additions & 6 deletions static/openapi/schema_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1088,19 +1088,19 @@
"description": "## Get user's asset usage\n",
"parameters": [
{
"name": "page",
"name": "limit",
"required": false,
"in": "query",
"description": "A page number within the paginated result set.",
"description": "Number of results to return per page.",
"schema": {
"type": "integer"
}
},
{
"name": "page_size",
"name": "offset",
"required": false,
"in": "query",
"description": "Number of results to return per page.",
"description": "The initial index from which to return the results.",
"schema": {
"type": "integer"
}
Expand Down Expand Up @@ -16651,13 +16651,13 @@
"type": "string",
"nullable": true,
"format": "uri",
"example": "http://api.example.org/accounts/?page=4"
"example": "http://api.example.org/accounts/?offset=400&limit=100"
},
"previous": {
"type": "string",
"nullable": true,
"format": "uri",
"example": "http://api.example.org/accounts/?page=2"
"example": "http://api.example.org/accounts/?offset=200&limit=100"
},
"results": {
"type": "array",
Expand Down
12 changes: 6 additions & 6 deletions static/openapi/schema_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -738,16 +738,16 @@ paths:
description: |
## Get user's asset usage
parameters:
- name: page
- name: limit
required: false
in: query
description: A page number within the paginated result set.
description: Number of results to return per page.
schema:
type: integer
- name: page_size
- name: offset
required: false
in: query
description: Number of results to return per page.
description: The initial index from which to return the results.
schema:
type: integer
tags:
Expand Down Expand Up @@ -11923,12 +11923,12 @@ components:
type: string
nullable: true
format: uri
example: http://api.example.org/accounts/?page=4
example: http://api.example.org/accounts/?offset=400&limit=100
previous:
type: string
nullable: true
format: uri
example: http://api.example.org/accounts/?page=2
example: http://api.example.org/accounts/?offset=200&limit=100
results:
type: array
items:
Expand Down