Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add endpoint for minimum required flutter app
Roland Geiderc1208d111323
diff --git a/docs/changelog.rst b/docs/changelog.rstindex f99c7375d..2bf45a800 100644--- a/docs/changelog.rst+++ b/docs/changelog.rst@@ -37,6 +37,8 @@ Upgrade steps from 2.0:- field ``description`` was added, for longer descriptions+ /set/- field ``comment`` added, for user notes+ + /min-app-version/+ - New endpoint indicating minimum required version for flutter app* `#666`_, `#667`_, `#656`_ (thanks `@jackmulligan-ire`_), `#716`_.. _#133: https://github.com/wger-project/wger/issues/133diff --git a/wger/__init__.py b/wger/__init__.pyindex 716859df6..c73f49ca5 100644--- a/wger/__init__.py+++ b/wger/__init__.py@@ -5,7 +5,10 @@:license: GNU GPL, see LICENSE for more details."""-VERSION = (2, 1, 0, 'alpha', 2)++MIN_APP_VERSION = (1, 3, 0, 'final', 1)++VERSION = (2, 1, 0, 'alpha', 3)RELEASE = Falsediff --git a/wger/core/api/views.py b/wger/core/api/views.pyindex b98e1f288..dbbd0cc28 100644--- a/wger/core/api/views.py+++ b/wger/core/api/views.py@@ -31,7 +31,10 @@ from rest_framework.permissions import AllowAnyfrom rest_framework.response import Response# wger-from wger import get_version+from wger import (+ get_version,+ MIN_APP_VERSION,+)from wger.core.api.permissions import AllowRegisterUserfrom wger.core.api.serializers import (DaysOfWeekSerializer,@@ -99,10 +102,22 @@ class ApplicationVersionView(viewsets.ViewSet):"""permission_classes = (AllowAny, )- def get(self, request):+ @staticmethod+ def get(request):return Response(get_version())+class RequiredApplicationVersionView(viewsets.ViewSet):+ """+ Returns the minimum required version of flutter app to access this server+ """+ permission_classes = (AllowAny, )++ @staticmethod+ def get(request):+ return Response(get_version(MIN_APP_VERSION, True))++class UserAPILoginView(viewsets.ViewSet):"""API endpoint for api user objectsdiff --git a/wger/urls.py b/wger/urls.pyindex 810772a55..843b2ebc2 100644--- a/wger/urls.py+++ b/wger/urls.py@@ -198,6 +198,11 @@ urlpatterns += [core_api_views.ApplicationVersionView.as_view({'get': 'get'}),name='app_version'),+ path(+ 'api/v2/min-app-version/',+ core_api_views.RequiredApplicationVersionView.as_view({'get': 'get'}),+ name='min_app_version'+ ),]#