-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add total number lines changed since #202
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,8 @@ exports.search = async (req, res) => { | |
|
||
if (searchQuery) { | ||
if (searchType === 0) { | ||
// First letter start | ||
// First letter start=> { | ||
// } | ||
const queryObj = lib.searchOperators.firstLetterStartToQuery( | ||
charCodeQuery, | ||
charCodeQueryWildCard, | ||
|
@@ -600,3 +601,23 @@ const getNavigation = async (req, res, type, first, last, source = '') => { | |
} | ||
return {}; | ||
}; | ||
|
||
exports.updates = async (req, res) => { | ||
let conn; | ||
const { Date } = req.params; | ||
|
||
try { | ||
conn = await req.app.locals.pool.getConnection(); | ||
|
||
if (!Date) res.json({ error: 'please enter valid date' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
const query = `SELECT COUNT(*) FROM Verse WHERE Updated >= '${Date}'`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably use a parameterized query and/or do more thorough input sanitization on line 612 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some input sanitization that need to be done
both of those should return 422 with appropriate messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do i check if the date is formatted correctly? Do i have to use some regex thingy or something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regex could work. check out https://regexlib.com/REDetails.aspx?regexp_id=95 |
||
|
||
const dbCount = await conn.query(query); | ||
|
||
res.json({ updatedVerses: dbCount[0]['COUNT(*)'] }); | ||
} catch (err) { | ||
lib.error(err, res, 500); | ||
} finally { | ||
if (conn) conn.end(); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=>{} not needed in this comment