You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
const fastify = require("fastify");
|
|
const userController = require("../controllers/userController");
|
|
|
|
module.exports = function (fastify, opts, next) {
|
|
fastify.route({
|
|
method: "POST",
|
|
url: "/api/forTesting/getphoneuser",
|
|
schema: {
|
|
tags: ["ForTesting"],
|
|
description:
|
|
"This is get the user in the system for a given phone number",
|
|
summary:
|
|
"Pass the phone in the format +11234567890 ( us format with the country code )",
|
|
body: {
|
|
type: "object",
|
|
required: ["phone"],
|
|
properties: {
|
|
phone: { type: "string" },
|
|
},
|
|
},
|
|
security: [
|
|
{
|
|
basicAuth: [],
|
|
},
|
|
],
|
|
},
|
|
//preHandler: fastify.auth([fastify.authenticate]),
|
|
handler: userController.getPhoneUser,
|
|
});
|
|
|
|
fastify.route({
|
|
method: "POST",
|
|
url: "/api/forTesting/delphoneuser",
|
|
schema: {
|
|
tags: ["ForTesting"],
|
|
description:
|
|
"This is delete a user in the system for a given phone number",
|
|
summary:
|
|
"Pass the phone in the format +11234567890 ( us format with the country code )",
|
|
body: {
|
|
type: "object",
|
|
required: ["phone"],
|
|
properties: {
|
|
phone: { type: "string" },
|
|
},
|
|
},
|
|
security: [
|
|
{
|
|
basicAuth: [],
|
|
},
|
|
],
|
|
},
|
|
// Add authentication after testing
|
|
//preHandler: fastify.auth([fastify.authenticate]),
|
|
handler: userController.delPhoneUser,
|
|
});
|
|
|
|
// Login for a user is in the main index.js file.
|
|
// fastify-jwt used to create the token was throwing exceptions and requierd
|
|
// it be called before the route is loaded.
|
|
next();
|
|
};
|