-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove log changes in backend/src/tasks
- Loading branch information
Showing
31 changed files
with
214 additions
and
247 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,22 +1,21 @@ | ||
import { Handler } from 'aws-lambda'; | ||
import { connectToDatabase, User } from '../models'; | ||
import ESClient from '../tasks/es-client'; | ||
import logger from '../tools/lambda-logger'; | ||
|
||
export const handler: Handler = async (event, context) => { | ||
export const handler: Handler = async (event) => { | ||
if (event.mode === 'db') { | ||
const connection = await connectToDatabase(); | ||
const connection = await connectToDatabase(true); | ||
const res = await connection.query(event.query); | ||
logger.info(JSON.stringify(res), { context }); | ||
console.log(res); | ||
} else if (event.mode === 'es') { | ||
if (event.query === 'delete') { | ||
const client = new ESClient(); | ||
await client.deleteAll(); | ||
logger.info('Index successfully deleted', { context }); | ||
console.log('Index successfully deleted'); | ||
} else { | ||
logger.info(`Query not found: ${event.query}`, { context }); | ||
console.log('Query not found: ' + event.query); | ||
} | ||
} else { | ||
logger.info(`Mode not found: ${event.mode}`, { context }); | ||
console.log('Mode not found: ' + event.mode); | ||
} | ||
}; |
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
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
Oops, something went wrong.