Skip to content

Commit

Permalink
Created some placeholders and updated package-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
pc committed Oct 2, 2019
1 parent 4130f7b commit 0b885c0
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 9 deletions.
12 changes: 11 additions & 1 deletion api/adminHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ const listEntries = async (body, context, callback) => {
})
}

// TODO: Decide Structure
const updateEntry = async (body, context, callback) => {
const entry = await candidateQB.updatEntry(body.query)
respondBack({
callback,
body: {entry}
})
}

module.exports = {
loginHandler,
listExams,
listEntries
listEntries,
updateEntry
}
14 changes: 13 additions & 1 deletion api/candidateHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@ const getQuestion = async (body, context, callback) => {
})
}

// TODO: Decide Structure
const updateAnswer = async (body, context, callback) => {
const candidate = await candidateQB.updateAnswer(body.query)
respondBack({
callback,
body: {
candidate
}
})
}

module.exports = {
registerHandler,
listQuestions,
getQuestion
getQuestion,
updateAnswer
}
4 changes: 4 additions & 0 deletions api/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module.exports.apiAdminHandler = async (event, context, callback) => {
case 'listEntries':
adminHandler.listEntries(body, context, callback)
break;
case 'updateEntry':
adminHandler.updateEntry(body, context, callback)

default:
break;
Expand Down Expand Up @@ -51,6 +53,8 @@ module.exports.apiCandidateHandler = async (event, context, callback) => {
case 'getQuestion':
candidateHandler.getQuestion(body, context, callback)
break;
case 'updateAnswer':
candidateHandler.updateAnswer(body, context, callback)
default:
break;
}
Expand Down
32 changes: 31 additions & 1 deletion database/candidateQueryBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,38 @@ const registerUser = async (attrs) => {
return resp.Attributes
}

// TODO
const updateAnswer = async(attrs) => {
let query = {
"TableName": process.env.CANDIDATE_TABLE,
"Key": {
id: attrs.id
},
"ExpressionAttributeValues": {},
"UpdateExpression": "",
"ReturnValues": "ALL_NEW"
}
return await dbHandler.docClient.update(query).promise()
}

// TODO
const updateEntry = async(attrs) => {
let query = {
"TableName": process.env.CANDIDATE_TABLE,
"Key": {
id: attrs.id
},
"ExpressionAttributeValues": {},
"UpdateExpression": "",
"ReturnValues": "ALL_NEW"
}
return await dbHandler.docClient.update(query).promise()
}

module.exports = {
listEntries,
getCandidate,
registerUser
registerUser,
updateAnswer,
updateEntry
}
45 changes: 39 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b885c0

Please sign in to comment.