app version api added app type
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user