|
|
|
@ -9,7 +9,9 @@ const libphonenumberjs = require("libphonenumber-js");
|
|
|
|
|
const boom = require("boom");
|
|
|
|
|
|
|
|
|
|
// Get Data Models
|
|
|
|
|
const User = require("../models/User");
|
|
|
|
|
//const User = require("../models/User");
|
|
|
|
|
const { User, Counter,Test } = require('../models/User');
|
|
|
|
|
|
|
|
|
|
const customJwtAuth = require("../customAuthJwt");
|
|
|
|
|
const fastify = require("fastify")({
|
|
|
|
|
logger: true,
|
|
|
|
@ -156,8 +158,10 @@ exports.editCuurentUserInfo = async (req, reply) => {
|
|
|
|
|
// Function accepts username, password , encrypts password and saves it in the database.
|
|
|
|
|
exports.addUser = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
// console.log("This is the reply in the handler after the validations", reply);
|
|
|
|
|
userData = {
|
|
|
|
|
|
|
|
|
|
username: req.body.username,
|
|
|
|
|
emails: req.body.emails,
|
|
|
|
|
password: req.body.password,
|
|
|
|
@ -175,7 +179,7 @@ exports.addUser = async (req, reply) => {
|
|
|
|
|
notes: req.body.notes,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
console.log(counter.seq)
|
|
|
|
|
var user = new User(userData);
|
|
|
|
|
|
|
|
|
|
//password is not at the top level in the collection.
|
|
|
|
@ -187,6 +191,7 @@ exports.addUser = async (req, reply) => {
|
|
|
|
|
if (checkFormEncoding.isUserFormUrlEncoded) {
|
|
|
|
|
usertobeInserted = checkFormEncoding.user;
|
|
|
|
|
console.log("thsi true url string");
|
|
|
|
|
|
|
|
|
|
user.username = usertobeInserted.username;
|
|
|
|
|
user.firstName = usertobeInserted.firstName;
|
|
|
|
|
user.lastName = usertobeInserted.lastName;
|
|
|
|
|