diff --git a/accounts/api/views.py b/accounts/api/views.py index e676a23..52a04b7 100644 --- a/accounts/api/views.py +++ b/accounts/api/views.py @@ -958,11 +958,12 @@ class VersionCheck(APIView): permission_classes = [] def get(self, request, *args, **kwargs): - app_version = request.GET.get("appVersion") + app_version = request.query_params.get("appVersion", None) + app_type = request.query_params.get("type", None) # Query the database to retrieve the upgrade flags based on the app version try: - version = AppVersion.objects.get(version=app_version) + version = AppVersion.objects.get(version=app_version, app_type=app_type) except AppVersion.DoesNotExist: version = None diff --git a/accounts/models.py b/accounts/models.py index 8d8e4a2..e1a7b2d 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -502,6 +502,11 @@ class IAmPrincipalLocation(BaseModel): # return f"KYC Information for {self.principal.email}" +class AppType(models.TextChoices): + ANDROID = "adroid", "android" + IOS = "ios", "ios" + + class AppVersion(models.Model): version = models.CharField( max_length=10, validators=[RegexValidator(r"^\d+\.\d+\.\d+$")] @@ -514,6 +519,7 @@ class AppVersion(models.Model): default=False, help_text="Indicates whether a recommend upgrade is needed for this app version.", ) + app_type = models.CharField(max_length=10, choices=AppType.choices) class Meta: db_table = "app_version"