@overmap-ai/core 1.0.60-geo-images.0 → 1.0.60-geo-images.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7219,9 +7219,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7219
7219
|
const { store } = this.client;
|
|
7220
7220
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7221
7221
|
const currentUser = store.getState().userReducer.currentUser;
|
|
7222
|
-
const
|
|
7223
|
-
const
|
|
7224
|
-
const
|
|
7222
|
+
const offlineGeoImages = [];
|
|
7223
|
+
const offlineIds = [];
|
|
7224
|
+
const geoImagePayloads = [];
|
|
7225
7225
|
const filePayloadRecord = {};
|
|
7226
7226
|
for (const payloadAndFile of payloadAndFiles) {
|
|
7227
7227
|
const { payload, file } = payloadAndFile;
|
|
@@ -7244,9 +7244,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7244
7244
|
created_by: currentUser.id,
|
|
7245
7245
|
project: projectId
|
|
7246
7246
|
});
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7247
|
+
offlineGeoImages.push(offlineMapImage);
|
|
7248
|
+
offlineIds.push(offlineMapImage.offline_id);
|
|
7249
|
+
geoImagePayloads.push({
|
|
7250
7250
|
offline_id: offlineMapImage.offline_id,
|
|
7251
7251
|
sha1: offlineMapImage.file_sha1,
|
|
7252
7252
|
file_name: offlineMapImage.file_name,
|
|
@@ -7258,7 +7258,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7258
7258
|
original_date: offlineMapImage.original_date
|
|
7259
7259
|
});
|
|
7260
7260
|
}
|
|
7261
|
-
store.dispatch(addGeoImages(
|
|
7261
|
+
store.dispatch(addGeoImages(offlineGeoImages));
|
|
7262
7262
|
const promise = this.enqueueRequest({
|
|
7263
7263
|
description: "Bulk add geo images",
|
|
7264
7264
|
method: HttpMethod.POST,
|
|
@@ -7266,28 +7266,28 @@ var __publicField = (obj, key, value) => {
|
|
|
7266
7266
|
payload: {
|
|
7267
7267
|
submitted_at: submittedAt,
|
|
7268
7268
|
project: projectId,
|
|
7269
|
-
geo_images:
|
|
7269
|
+
geo_images: geoImagePayloads,
|
|
7270
7270
|
files: Object.values(filePayloadRecord)
|
|
7271
7271
|
},
|
|
7272
7272
|
blocks: [projectId.toString()],
|
|
7273
|
-
blockers:
|
|
7273
|
+
blockers: offlineIds
|
|
7274
7274
|
});
|
|
7275
7275
|
promise.then((result) => {
|
|
7276
7276
|
this.processPresignedUrls(result.presigned_urls);
|
|
7277
|
-
store.dispatch(setGeoImages(result.
|
|
7277
|
+
store.dispatch(setGeoImages(result.geo_images));
|
|
7278
7278
|
}).catch(() => {
|
|
7279
|
-
store.dispatch(deleteGeoImages(
|
|
7279
|
+
store.dispatch(deleteGeoImages(offlineIds));
|
|
7280
7280
|
});
|
|
7281
|
-
return [
|
|
7281
|
+
return [offlineGeoImages, promise.then((result) => result.geo_images)];
|
|
7282
7282
|
}
|
|
7283
7283
|
update(payload) {
|
|
7284
7284
|
const { store } = this.client;
|
|
7285
7285
|
const state = store.getState();
|
|
7286
|
-
const
|
|
7287
|
-
if (!
|
|
7286
|
+
const geoImageToUpdate = selectGeoImageById(payload.offline_id)(state);
|
|
7287
|
+
if (!geoImageToUpdate) {
|
|
7288
7288
|
throw new Error(`Map image with offline_id ${payload.offline_id} does not exist in the store`);
|
|
7289
7289
|
}
|
|
7290
|
-
const updatedGeoImage = { ...
|
|
7290
|
+
const updatedGeoImage = { ...geoImageToUpdate, ...payload };
|
|
7291
7291
|
store.dispatch(updateGeoImage(updatedGeoImage));
|
|
7292
7292
|
const promise = this.enqueueRequest({
|
|
7293
7293
|
description: "Update geo image",
|
|
@@ -7300,15 +7300,15 @@ var __publicField = (obj, key, value) => {
|
|
|
7300
7300
|
promise.then((result) => {
|
|
7301
7301
|
store.dispatch(setGeoImage(result));
|
|
7302
7302
|
}).catch(() => {
|
|
7303
|
-
store.dispatch(setGeoImage(
|
|
7303
|
+
store.dispatch(setGeoImage(geoImageToUpdate));
|
|
7304
7304
|
});
|
|
7305
7305
|
return [updatedGeoImage, promise];
|
|
7306
7306
|
}
|
|
7307
7307
|
async delete(geoImageId) {
|
|
7308
7308
|
const { store } = this.client;
|
|
7309
7309
|
const state = store.getState();
|
|
7310
|
-
const
|
|
7311
|
-
if (!
|
|
7310
|
+
const geoImageToDelete = selectGeoImageById(geoImageId)(state);
|
|
7311
|
+
if (!geoImageToDelete) {
|
|
7312
7312
|
throw new Error(`Map image with offline_id ${geoImageId} does not exist in the store`);
|
|
7313
7313
|
}
|
|
7314
7314
|
store.dispatch(deleteGeoImage(geoImageId));
|
|
@@ -7320,7 +7320,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7320
7320
|
blockers: [geoImageId]
|
|
7321
7321
|
});
|
|
7322
7322
|
promise.catch(() => {
|
|
7323
|
-
store.dispatch(setGeoImage(
|
|
7323
|
+
store.dispatch(setGeoImage(geoImageToDelete));
|
|
7324
7324
|
});
|
|
7325
7325
|
return promise;
|
|
7326
7326
|
}
|