|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
const userController = require("./controllers/userController");
|
|
|
|
|
const { User,Counter, generateBookingId,resetCounter,generateCustomerId,ProfilePicture} = require('./models/User')
|
|
|
|
|
|
|
|
|
|
const tanksController = require("./controllers/tanksController");
|
|
|
|
|
const tankersController = require("./controllers/tankersController.js");
|
|
|
|
|
const createConnectionController = require("./controllers/createConnectionController");
|
|
|
|
@ -206,6 +208,8 @@ fastify.post("/api/login", {
|
|
|
|
|
var arr = loginObject.user.profile.role;
|
|
|
|
|
var arrayToString = JSON.stringify(Object.assign({}, arr)); // convert array to string
|
|
|
|
|
var stringToJsonObject = JSON.parse(arrayToString); // convert string to json object
|
|
|
|
|
var c_id = loginObject.user.customerId
|
|
|
|
|
var profilePicture = await ProfilePicture.findOne({ customerId:c_id});
|
|
|
|
|
|
|
|
|
|
// console.log({
|
|
|
|
|
// username: loginObject.user.username,
|
|
|
|
@ -219,6 +223,7 @@ fastify.post("/api/login", {
|
|
|
|
|
error: false,
|
|
|
|
|
apiversion: fastify.config.APIVERSION,
|
|
|
|
|
access_token: token,
|
|
|
|
|
picture:profilePicture.picture,
|
|
|
|
|
email: loginObject.user.emails,
|
|
|
|
|
phone: loginObject.user.phone,
|
|
|
|
|
customerId: loginObject.user.customerId,
|
|
|
|
|