Skip to content

Commit

Permalink
style: formatting & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Nov 7, 2023
1 parent 15a2610 commit 648de8a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/HistoryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ function getPositions(
outputPositionsJson(rows, context, from, to, res)
} else {
// requested format not supported, return error with list of supported formats
outputError(res, 400, 'Format \'' + format + '\' is not supported. Supported formats are: ' + supportedFormats + '.')
outputError(
res,
400,
"Format '" + format + "' is not supported. Supported formats are: " + supportedFormats + '.',
)
}
})
}
Expand Down Expand Up @@ -351,12 +355,13 @@ function splitPathExpression(pathExpression: string): PathSpec {
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function outputPositionsGpx(rows: any[], context: string, res: Response) {
let responseBody = `<?xml version="1.0" encoding="UTF-8" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="signalk-to-influxdb2">
<metadata><author>${context}</author></metadata>
<trk>`
let inSegment = false;
let inSegment = false
rows.forEach((p) => {
if (p.lat != null && p.lon != null) {
if (!inSegment) {
Expand All @@ -375,7 +380,7 @@ function outputPositionsGpx(rows: any[], context: string, res: Response) {
responseBody += `
</trk>
</gpx>`
res.header("Content-Type", "application/xml")
res.header('Content-Type', 'application/xml')
res.status(200)
res.send(responseBody)
}
Expand All @@ -400,7 +405,7 @@ function outputError(res: Response, status: number, detail: string) {
res.status(status)
res.json({
status: status.toString(),
detail: detail
detail: detail,
})
}

Expand Down

0 comments on commit 648de8a

Please sign in to comment.