made changes in profile picture and created get all tanker data

master
varun 3 years ago
parent 144587e196
commit 59a3325ec5

@ -178,6 +178,24 @@ exports.getTanker = async (req, reply) => {
}
};
exports.getallTanker = async (req, reply) => {
try {
await Tanker.find()
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
.catch((err) => {
console.log(err);
reply.send({ error: err });
});
} catch (err) {
throw boom.boomify(err);
}
};

@ -342,7 +342,7 @@ exports.delPhoneUser = async (req, reply) => {
exports.uploadProfilePicture = async (req, reply) => {
try {
const customerId = req.params.customerId;
const picture = new Buffer.from(req.body.picture, 'base64');
const picture = req.body.picture;
let profilePicture = await ProfilePicture.findOne({ customerId });

@ -117,7 +117,7 @@ const profilePictureSchema = new Schema({
required: true
},
picture: {
type: Buffer,
type: String,
required: true
}
});

@ -232,6 +232,22 @@ module.exports = function (fastify, opts, next) {
handler: tankersController.getTanker,
});
fastify.get("/api/getallTankers", {
schema: {
tags: ["Supplier"],
description: "This is for Get all Tanker Data",
summary: "This is for to Get all Tanker Data",
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: tankersController.getallTanker,
});
fastify.route({
method: "POST",
url: "/api/addBores/:customerId",

Loading…
Cancel
Save