-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ru Chern Chong
committed
Dec 25, 2023
1 parent
09d6df9
commit 5e5f293
Showing
3 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import { ApiHandler } from "sst/node/api"; | ||
import { ApiHandler, useQueryParam, useQueryParams } from "sst/node/api"; | ||
import { COE } from "@lta-cars-dataset/core/coe"; | ||
import { createResponse } from "./utils/createResponse"; | ||
|
||
export const latest = ApiHandler(async (_evt) => { | ||
const coeResult = await COE.latest(); | ||
export const list = ApiHandler(async (_evt) => { | ||
const result = await COE.list(); | ||
return createResponse(result); | ||
}); | ||
|
||
export const byMonth = ApiHandler(async (_evt) => { | ||
const month = useQueryParam("month"); | ||
const coeResult = await COE.getCOEResultByMonth(month); | ||
|
||
return createResponse(coeResult); | ||
}); | ||
|
||
export const latest = ApiHandler(async (_evt) => { | ||
const result = await COE.getCOEResultByMonth(); | ||
return createResponse(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters