30 lines
802 B
Python
30 lines
802 B
Python
from core.models.ClientVersion import ClientVersion
|
|
from core.services.WebServiceApiService import WebServiceApiService
|
|
from typing import Optional
|
|
|
|
|
|
class ClientVersionController:
|
|
|
|
@staticmethod
|
|
def get_latest():
|
|
return ClientVersion.latest()
|
|
|
|
@staticmethod
|
|
def is_latest(client_version):
|
|
return client_version.version_number == ClientVersion.latest().version_number
|
|
|
|
@staticmethod
|
|
def get(version_number: str):
|
|
return ClientVersion.find(version_number)
|
|
|
|
@staticmethod
|
|
def get_all():
|
|
return ClientVersion.all()
|
|
|
|
@staticmethod
|
|
def fetch(proxies: Optional[dict] = None):
|
|
|
|
client_versions = WebServiceApiService.get_client_versions(proxies)
|
|
|
|
ClientVersion.truncate()
|
|
ClientVersion.save_many(client_versions)
|