|
|
|
@ -2,7 +2,7 @@ const fastify = require("fastify");
|
|
|
|
|
const storeController = require('../controllers/storeController')
|
|
|
|
|
const customJwtAuth = require('../customAuthJwt');
|
|
|
|
|
const fastifyJwt = require('fastify-jwt');
|
|
|
|
|
|
|
|
|
|
const userController = require('../controllers/userController');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function (fastify, opts, next) {
|
|
|
|
@ -308,6 +308,125 @@ fastify.put('/api/editStore/:storeId', {
|
|
|
|
|
handler: storeController.editStore,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/getAllInstallers", {
|
|
|
|
|
schema: {
|
|
|
|
|
description: "Retrieve all users",
|
|
|
|
|
tags: ["Install Management"],
|
|
|
|
|
summary: "Get all users",
|
|
|
|
|
// response: {
|
|
|
|
|
// 200: {
|
|
|
|
|
// type: "array",
|
|
|
|
|
// items: {
|
|
|
|
|
// type: "object",
|
|
|
|
|
// properties: {
|
|
|
|
|
// installationId: { type: "string" },
|
|
|
|
|
// phone: { type: "string" },
|
|
|
|
|
// password: { type: "string" },
|
|
|
|
|
// emails: { type: "array", items: { type: "object", properties: { email: { type: "string" } } } },
|
|
|
|
|
// team: { type: "string" },
|
|
|
|
|
// manager: { type: "string" },
|
|
|
|
|
// address: { type: "string" },
|
|
|
|
|
// address1: { type: "string" },
|
|
|
|
|
// address2: { type: "string" },
|
|
|
|
|
// city: { type: "string" },
|
|
|
|
|
// state: { type: "string" },
|
|
|
|
|
// zip: { type: "string" },
|
|
|
|
|
// country: { type: "string" },
|
|
|
|
|
// notes: { type: "string" },
|
|
|
|
|
// latitude: { type: "number" },
|
|
|
|
|
// longitude: { type: "number" },
|
|
|
|
|
// fcmId: { type: "string" },
|
|
|
|
|
// alternativeNumber: { type: "string" },
|
|
|
|
|
// firstName: { type: "string" },
|
|
|
|
|
// lastName: { type: "string" },
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
},
|
|
|
|
|
handler: storeController.getAllUsers,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.delete("/api/users/:installationId", {
|
|
|
|
|
schema: {
|
|
|
|
|
description: "Delete a user by installationId",
|
|
|
|
|
tags: ["Install Management"],
|
|
|
|
|
summary: "Delete user",
|
|
|
|
|
params: {
|
|
|
|
|
type: "object",
|
|
|
|
|
properties: {
|
|
|
|
|
installationId: { type: "string" },
|
|
|
|
|
},
|
|
|
|
|
required: ["installationId"],
|
|
|
|
|
},
|
|
|
|
|
response: {
|
|
|
|
|
200: {
|
|
|
|
|
type: "object",
|
|
|
|
|
properties: {
|
|
|
|
|
message: { type: "string" },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
handler: storeController.deleteUserByInstallationId,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.put("/api/users/:installationId", {
|
|
|
|
|
schema: {
|
|
|
|
|
description: "Update user details by installationId",
|
|
|
|
|
tags: ["Install Management"],
|
|
|
|
|
summary: "Update user",
|
|
|
|
|
params: {
|
|
|
|
|
type: "object",
|
|
|
|
|
properties: {
|
|
|
|
|
installationId: { type: "string" },
|
|
|
|
|
},
|
|
|
|
|
required: ["installationId"],
|
|
|
|
|
},
|
|
|
|
|
body: {
|
|
|
|
|
type: "object",
|
|
|
|
|
properties: {
|
|
|
|
|
phone: { type: "string" },
|
|
|
|
|
password: { type: "string" },
|
|
|
|
|
emails: { type: "array", items: { type: "object", properties: { email: { type: "string" } } } },
|
|
|
|
|
team: { type: "string" },
|
|
|
|
|
manager: { type: "string" },
|
|
|
|
|
address: { type: "string" },
|
|
|
|
|
address1: { type: "string" },
|
|
|
|
|
address2: { type: "string" },
|
|
|
|
|
city: { type: "string" },
|
|
|
|
|
state: { type: "string" },
|
|
|
|
|
zip: { type: "string" },
|
|
|
|
|
country: { type: "string" },
|
|
|
|
|
notes: { type: "string" },
|
|
|
|
|
latitude: { type: "number" },
|
|
|
|
|
longitude: { type: "number" },
|
|
|
|
|
fcmId: { type: "string" },
|
|
|
|
|
alternativeNumber: { type: "string" },
|
|
|
|
|
firstName: { type: "string" },
|
|
|
|
|
lastName: { type: "string" },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
response: {
|
|
|
|
|
200: {
|
|
|
|
|
type: "object",
|
|
|
|
|
properties: {
|
|
|
|
|
message: { type: "string" },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
handler: storeController.updateUserByInstallationId,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/getusersofParticularInstaller", {
|
|
|
|
|
schema: {
|
|
|
|
|
tags: ["Install"],
|
|
|
|
|