Skip to content

Commit

Permalink
allow returning metadata only
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhorner committed Sep 14, 2024
1 parent d499ade commit 25f0ece
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/tracks/tracks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,23 @@ export class TracksController {
constructor(private readonly tracksService: TracksService) {}

@Get()
async list(@Query("start") start?: string, @Query("end") end?: string) {
async list(
@Query("start") start?: string,
@Query("end") end?: string,
@Query("format") format?: string,
) {
const tracks = await this.tracksService.list({ start, end })
return this.tracksService.toGeoJSON(tracks)

if (format === "geojson") {
return this.tracksService.toGeoJSON(tracks)
}

return tracks.map((track) => ({
id: track.id,
captureDate: track.captureDate,
filePath: track.filePath,
fileHash: track.fileHash,
}))
}

@Post("import")
Expand Down

0 comments on commit 25f0ece

Please sign in to comment.