speed up file uploads
This commit is contained in:
@@ -255,11 +255,11 @@ class PackageModel extends BaseModel {
|
||||
if (files.length > uploadPhotoLimit)
|
||||
throw Exception("Exceed number of file upload");
|
||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||
for (File f in files) {
|
||||
String path = Path.join(pkg_files_path);
|
||||
String url = await uploadStorage(path, f);
|
||||
String path = Path.join(pkg_files_path);
|
||||
List<String> urls = await uploadFiles(path, files);
|
||||
urls.forEach((url) {
|
||||
package.photoUrls.add(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Services.instance.packageService.createReceiving(package);
|
||||
}
|
||||
@@ -284,11 +284,11 @@ class PackageModel extends BaseModel {
|
||||
if (count > uploadPhotoLimit)
|
||||
throw Exception("Exceed number of file upload");
|
||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||
for (File f in files) {
|
||||
String path = Path.join(pkg_files_path);
|
||||
String url = await uploadStorage(path, f);
|
||||
String path = Path.join(pkg_files_path);
|
||||
List<String> urls = await uploadFiles(path, files);
|
||||
urls.forEach((url) {
|
||||
package.photoUrls.add(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
await Services.instance.packageService.updateReceiving(package);
|
||||
}
|
||||
@@ -314,11 +314,11 @@ class PackageModel extends BaseModel {
|
||||
if (count > uploadPhotoLimit)
|
||||
throw Exception("Exceed number of file upload");
|
||||
package.photoUrls = package.photoUrls == null ? [] : package.photoUrls;
|
||||
for (File f in files) {
|
||||
String path = Path.join(pkg_files_path);
|
||||
String url = await uploadStorage(path, f);
|
||||
String path = Path.join(pkg_files_path);
|
||||
List<String> urls = await uploadFiles(path, files);
|
||||
urls.forEach((url) {
|
||||
package.photoUrls.add(url);
|
||||
}
|
||||
});
|
||||
package.photoUrls.removeWhere((e) => deletedUrls.contains(e));
|
||||
}
|
||||
await Services.instance.packageService.updateProcessing(package);
|
||||
|
||||
Reference in New Issue
Block a user