diff --git a/packages/core/src/datasets.ts b/packages/core/src/datasets.ts index cb02857..1b23ec4 100644 --- a/packages/core/src/datasets.ts +++ b/packages/core/src/datasets.ts @@ -9,8 +9,6 @@ export const updater = async () => { const extractToPath = "/tmp"; const zipFileName = `Monthly New Registration of Cars by Make.zip`; const zipFilePath = `${extractToPath}/${zipFileName}`; - const csvFileName = `M03-Car_Regn_by_make.csv`; - const csvFilePath = `${extractToPath}/${csvFileName}`; const zipUrl = `https://datamall.lta.gov.sg/content/dam/datamall/datasets/Facts_Figures/Vehicle Registration/${zipFileName}`; await downloadFile({ @@ -57,11 +55,10 @@ export const updater = async () => { const result = await db.collection("cars").insertMany(newDataToInsert); message = `${result.insertedCount} document(s) inserted`; } else { - message = "No new data to insert"; + message = + "No new data to insert. The provided data matches the existing records."; } } - console.log(message); - return { message }; }; diff --git a/packages/functions/src/datasets.ts b/packages/functions/src/datasets.ts index f089899..735bec4 100644 --- a/packages/functions/src/datasets.ts +++ b/packages/functions/src/datasets.ts @@ -4,8 +4,10 @@ import { Datasets } from "@lta-datasets-updater/core/datasets"; export const updater = ApiHandler(async (_evt, context) => { const { message } = await Datasets.updater(); + console.log(`Message:`, message); + return { statusCode: 200, - body: JSON.stringify({ message }), + body: JSON.stringify({ status: 200, message }), }; });