|
1 | 1 | from cache_memoize import cache_memoize |
2 | 2 | from django.db.models import Q |
| 3 | +from drf_yasg import openapi |
| 4 | +from drf_yasg.utils import swagger_auto_schema |
3 | 5 | from rest_framework.exceptions import NotFound, PermissionDenied |
4 | 6 | from rest_framework.permissions import IsAuthenticated |
5 | 7 | from rest_framework.views import APIView |
@@ -181,6 +183,52 @@ def _get_user_managed_orgs(self, request): |
181 | 183 | return [] |
182 | 184 | return orgs |
183 | 185 |
|
| 186 | + @swagger_auto_schema( |
| 187 | + manual_parameters=[ |
| 188 | + openapi.Parameter( |
| 189 | + "organization_slug", |
| 190 | + openapi.IN_QUERY, |
| 191 | + description="Organization slug (e.g. PHYTunes)", |
| 192 | + type=openapi.TYPE_STRING, |
| 193 | + required=False, |
| 194 | + ), |
| 195 | + openapi.Parameter( |
| 196 | + "location_id", |
| 197 | + openapi.IN_QUERY, |
| 198 | + description="Location ID", |
| 199 | + type=openapi.TYPE_STRING, |
| 200 | + required=False, |
| 201 | + ), |
| 202 | + openapi.Parameter( |
| 203 | + "floorplan_id", |
| 204 | + openapi.IN_QUERY, |
| 205 | + description="Floor plan ID.", |
| 206 | + type=openapi.TYPE_STRING, |
| 207 | + required=False, |
| 208 | + ), |
| 209 | + openapi.Parameter( |
| 210 | + "time", |
| 211 | + openapi.IN_QUERY, |
| 212 | + description="Timeframe in days (e.g. 1d means 1 day and same goes with higher)", |
| 213 | + type=openapi.TYPE_STRING, |
| 214 | + required=False, |
| 215 | + ), |
| 216 | + openapi.Parameter( |
| 217 | + "start", |
| 218 | + openapi.IN_QUERY, |
| 219 | + description="Start time in YYYY-MM-DD H:M:S format", |
| 220 | + type=openapi.TYPE_STRING, |
| 221 | + required=False, |
| 222 | + ), |
| 223 | + openapi.Parameter( |
| 224 | + "end", |
| 225 | + openapi.IN_QUERY, |
| 226 | + description="End time in YYYY-MM-DD H:M:S format", |
| 227 | + type=openapi.TYPE_STRING, |
| 228 | + required=False, |
| 229 | + ), |
| 230 | + ] |
| 231 | + ) |
184 | 232 | def get(self, request, *args, **kwargs): |
185 | 233 | response = super().get(request, *args, **kwargs) |
186 | 234 | if not request.GET.get("csv"): |
|
0 commit comments