diff --git a/src/html/callHTML.js b/src/html/callHTML.js index 400e722..7cc9321 100644 --- a/src/html/callHTML.js +++ b/src/html/callHTML.js @@ -3,7 +3,7 @@ import { navbar } from '../../utils/navbar.js'; function generateCallHTML(phoneNumber, name, callcount, session) { const head = `
${callcount} appels restants
${form}`; + const body = `${js}${navbar(session)}${callcount} appels restants
${form}`; return `${head}${body}`; } +const js = '\ +\ +'; + export { generateCallHTML }; diff --git a/src/html/pages/api/contacts/call.js b/src/html/pages/api/contacts/call.js new file mode 100644 index 0000000..d899d5f --- /dev/null +++ b/src/html/pages/api/contacts/call.js @@ -0,0 +1,14 @@ +import { permissionBits } from "../../../../../utils/permissions.js"; + +export default { + path: "/api/call/:phone", + requiresLogin: true, + permissions: permissionBits.ADMIN, + type: "post", + async execute(request, response) { + const { phone } = request.params; + const { vote } = request.body; + await global.database.contacts.update({ called: 1, vote: vote }, { where: { phone: phone } }); + response.status(201).send({ message: `Vote registered` }); + }, +};