diff --git a/v1/src/services/site.service.js b/v1/src/services/site.service.js index 05e225d..0425db9 100644 --- a/v1/src/services/site.service.js +++ b/v1/src/services/site.service.js @@ -45,12 +45,20 @@ const insertWithRelations = async (body) => { resistivities, } = body; - const siteToInsert = await insert(site); + const { height, ...siteWithoutHeight } = site; + + const siteToInsert = await insert({ ...siteWithoutHeight }); const siteBoundToInsert = await insertSiteBound({ site: siteToInsert._id, ...siteBound, }); + await insertRp({ + siteBound: siteBoundToInsert._id, + positionZ: height, + name: 'RP 0', + }); + for (const rp of rps) { const { discs, ...rest } = rp; const rpToInsert = await insertRp({