Skip to content

Commit

Permalink
fixed properties documentdata structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rfontanarosa committed Sep 27, 2024
1 parent 31f3fee commit c6e777e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions functions/src/on-create-loi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import {getDatastore} from './common/context';
import {Datastore} from './common/datastore';
import {broadcastSurveyUpdate} from './common/broadcast-survey-update';
import {GroundProtos} from '@ground/proto';
import {toGeoJsonGeometry, toMessage} from '@ground/lib';
import {toDocumentData, toGeoJsonGeometry, toMessage} from '@ground/lib';
import {geojsonToWKT} from '@terraformer/wkt';
import {toLoiPbProperties} from './import-geojson';

import Pb = GroundProtos.ground.v1beta1;

Expand Down Expand Up @@ -67,7 +68,11 @@ export async function onCreateLoiHandler(
.forEach(key => (properties[key] = JSON.stringify(properties[key])));
}

await db.updateLoiProperties(surveyId, loiId, properties);
await db.updateLoiProperties(
surveyId,
loiId,
toDocumentData(toLoiPbProperties(properties))
);

await broadcastSurveyUpdate(context.params.surveyId);
}
Expand Down

0 comments on commit c6e777e

Please sign in to comment.