ashok 1 year ago
commit 5e859799ca

@ -172,6 +172,7 @@ exports.addUser = async (req, reply) => {
var customer_id = `AWSU${building}${c_id}` var customer_id = `AWSU${building}${c_id}`
// console.log("This is the reply in the handler after the validations", reply); // console.log("This is the reply in the handler after the validations", reply);
userData = { userData = {
installationId:req.params.installationId,
customerId: customer_id, customerId: customer_id,
username: req.body.username, username: req.body.username,
emails: req.body.emails, emails: req.body.emails,
@ -208,6 +209,7 @@ exports.addUser = async (req, reply) => {
if (checkFormEncoding.isUserFormUrlEncoded) { if (checkFormEncoding.isUserFormUrlEncoded) {
usertobeInserted = checkFormEncoding.user; usertobeInserted = checkFormEncoding.user;
console.log("thsi true url string"); console.log("thsi true url string");
user.installationId = usertobeInserted.installationId;
user.username = usertobeInserted.username; user.username = usertobeInserted.username;
user.firstName = usertobeInserted.firstName; user.firstName = usertobeInserted.firstName;
user.lastName = usertobeInserted.lastName; user.lastName = usertobeInserted.lastName;

@ -43,6 +43,7 @@ const generateBookingId = async () => {
const userSchema = new mongoose.Schema( const userSchema = new mongoose.Schema(
{ {
installationId:{type:String},
username: { type: String }, username: { type: String },
phone: { type: String, unique: true, trim: true }, phone: { type: String, unique: true, trim: true },
address: String, address: String,

@ -123,11 +123,20 @@ module.exports = function (fastify, opts, next) {
fastify.route({ fastify.route({
method: "POST", method: "POST",
url: "/api/users", url: "/api/users/:installationId",
schema: { schema: {
tags: ["User"], tags: ["Install"],
description: "This is for cretae New user", description: "This is for cretae New user",
summary: "This is for Create New User.", summary: "This is for Create New User.",
params: {
type: "object",
properties: {
installationId: {
type: "string",
description: "installationId",
},
},
},
body: { body: {
type: "object", type: "object",
properties: { properties: {

Loading…
Cancel
Save