Ejemplo n.º 1
0
 def execute(self):
     apk = Apk(self.storage_name)
     apk.package_name = self.package_name
     version = Version()
     version.version_name = self.version
     version.version_id = self.version_id
     apk.version_set(version)
     apk.content = self.file["file_content"]
     apk.original_file_name = self.file["file_name"]
     apk.create()
     return ApkUploadDetail.create_from_apk(apk)
Ejemplo n.º 2
0
 def _get_apk_instance(self, result):
     from pystatic.domain.aggregates.apk.model.apk import Apk
     from pystatic.domain.aggregates.apk.model.version import Version
     apk = Apk(result["info"]["storage_name"])
     apk.content = result["binary_data"]
     apk._id = str(result["info"]["_id"])
     apk.upload_date = result["info"]["upload_date"]
     apk.package_name = result["info"]["package_name"]
     apk.version = Version()
     apk.version.version_id = result["info"]["version"]["version_id"]
     apk.version.version_name = result["info"]["version"]["version_name"]
     apk.original_file_name = result["info"]["original_file_name"]
     apk.persisted_file_name = result["info"]["persisted_file_name"]
     apk.path = result["info"]["path"]
     return apk
Ejemplo n.º 3
0
 def execute(self):
     apk = Apk.get_by_file_name(self.storage_name, self.file_name)
     return ApkDownloadDetail.create_from_apk(apk)
Ejemplo n.º 4
0
 def validate(self, version_id):
     file_version_id_exist = Apk.version_id_exist(self.storage_name, version_id)
     if file_version_id_exist:
         super().custom.manual(ApkErrorCodes.APK_VERSION_ID_EXIST)
Ejemplo n.º 5
0
 def execute(self):
     apk = Apk.get_by_version_id(self.storage_name, self.version_id)
     return ApkDownloadDetail.create_from_apk(apk)
Ejemplo n.º 6
0
 def execute(self):
     query_string_info = QueryStringInfo()
     search_info = query_string_info.load(self.query_string)
     apks = Apk.get_all(self.storage_name, search_info.skip, search_info.take)
     return ApkUploadDetail.create_apks_from_apks(apks)
Ejemplo n.º 7
0
 def validate(self, file_name):
     file_name_exist = Apk.file_name_exist(self.storage_name, file_name)
     if not file_name_exist:
         super().custom.manual(ApkErrorCodes.APK_FILE_NAME_NOT_EXIST)