const insertedPropId = await db.transaction(async (trx) => {
// insertPlaceDetails calls the db DIRECTLY, instead of something like
// trx.insert()
const insertedPlaceData = await insertPlaceDetails([
location.latitude,
location.longitude,
]);
const [insertedProperty] = await db
.insert(propertiesTable)
.values(propertyData)
.returning({ id: propertiesTable.id });
return insertedProperty.id;
});
return insertedPropId;
};
const insertedPropId = await db.transaction(async (trx) => {
// insertPlaceDetails calls the db DIRECTLY, instead of something like
// trx.insert()
const insertedPlaceData = await insertPlaceDetails([
location.latitude,
location.longitude,
]);
const [insertedProperty] = await db
.insert(propertiesTable)
.values(propertyData)
.returning({ id: propertiesTable.id });
return insertedProperty.id;
});
return insertedPropId;
};