Skip to content

Commit

Permalink
refactor: update repairs function (#11519)
Browse files Browse the repository at this point in the history
  • Loading branch information
huimiu authored Apr 30, 2024
1 parent 039039f commit 45ce3e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ const { app } = require("@azure/functions");
*/
async function repairs(req, context) {
context.log("HTTP trigger function processed a request.");

// Get the repair records from the data.json file.
const repairRecords = require("../repairsData.json");

// Initialize response.
const res = {
status: 200,
jsonBody: {
results: [],
results: repairRecords,
},
};

Expand All @@ -28,9 +32,6 @@ async function repairs(req, context) {
return res;
}

// Get the repair records from the data.json file.
const repairRecords = require("../repairsData.json");

// Filter the repair records by the assignedTo query parameter.
const repairs = repairRecords.filter((item) => {
const query = assignedTo.trim().toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function repairs(
const res: HttpResponseInit = {
status: 200,
jsonBody: {
results: [],
results: repairRecords,
},
};

Expand Down

0 comments on commit 45ce3e3

Please sign in to comment.