-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added get API endpoint for pacific power exclusion
- Loading branch information
Showing
3 changed files
with
63 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const Response = require('/opt/nodejs/response.js') | ||
const PacificPowerExclusion = require('/opt/nodejs/models/pacific_power_exclusion.js') | ||
|
||
exports.get = async (event, context) => { | ||
let response = new Response(event) | ||
response.body = JSON.stringify(await new PacificPowerExclusion().get()) | ||
return response | ||
} |
10 changes: 10 additions & 0 deletions
10
backend/dependencies/nodejs/models/pacific_power_exclusion.js
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const DB = require('/opt/nodejs/sql-access.js') | ||
|
||
class PacificPowerExclusion { | ||
async get() { | ||
await DB.connect() | ||
return DB.query(`SELECT * FROM pacific_power_exclusion`) | ||
} | ||
} | ||
|
||
module.exports = PacificPowerExclusion |
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