diff --git a/functions/model/librarian/librarian.js b/functions/model/librarian/librarian.js index b9c1948fa..e8767bfba 100644 --- a/functions/model/librarian/librarian.js +++ b/functions/model/librarian/librarian.js @@ -1,4 +1,5 @@ /* eslint-disable linebreak-style */ +/* eslint-disable no-undef */ /* eslint-disable object-curly-spacing */ /* eslint-disable eol-last */ /* eslint-disable indent */ diff --git a/functions/model/librarian/tark/uploadPostImages.js b/functions/model/librarian/tark/uploadPostImages.js index 930bd0482..80ad10485 100644 --- a/functions/model/librarian/tark/uploadPostImages.js +++ b/functions/model/librarian/tark/uploadPostImages.js @@ -1,4 +1,5 @@ /* eslint-disable linebreak-style */ +/* eslint-disable no-undef */ /* eslint-disable max-len */ /* eslint-disable no-trailing-spaces */ /* eslint-disable object-curly-spacing */ @@ -17,58 +18,58 @@ * See the MIT License for more details. ***********************************************************/ - const { setPostImages } = require("../lib"); - const { getPost, updatePost } = require("../../users/lib"); +const { setPostImages } = require("../lib"); +const { getPost, updatePost } = require("../../users/lib"); - exports.uploadProfilePicToUserDoc = function(request, response) { - const fileName = request.body.data.FileName; - const fileUrl = request.body.data.FileUrl; - const lastModified = request.body.data.LastModified; - const size = request.body.data.Size; - const date = request.body.data.Date; - const time = request.body.data.Time; - const basePath = request.body.data.BasePath; - const uid = request.body.data.Uid; +exports.uploadProfilePicToUserDoc = function(request, response) { + const fileName = request.body.data.FileName; + const fileUrl = request.body.data.FileUrl; + const lastModified = request.body.data.LastModified; + const size = request.body.data.Size; + const date = request.body.data.Date; + const time = request.body.data.Time; + const basePath = request.body.data.BasePath; + const uid = request.body.data.Uid; - let result; - let status = 200; + let result; + let status = 200; - const promise = getPost(postId).then((data) => { - let photoCounter = data.TotalPhotoCounter; - photoCounter++; + const promise = getPost(postId).then((data) => { + let photoCounter = data.TotalPhotoCounter; + photoCounter++; - const updateUserDocJson = { - TotalPhotoCounter: photoCounter, - }; - updatePost(updateUserDocJson, postId); + const updateUserDocJson = { + TotalPhotoCounter: photoCounter, + }; + updatePost(updateUserDocJson, postId); - const imageFileName = "P" + photoCounter; - const updateUserFileJson = { - FileName: fileName, - FileUrl: fileUrl, - LastModified: lastModified, - Size: size, - Date: date, - Time: time, - OrgFileDocumentName: orgFileDocumentName, - BasePath: basePath, - FileStatus: "OK", - }; - setPostImages(updateUserFileJson, postId, imageFileName); - }).catch((error) => { - status = 500; - console.log("Error:", error); - }); + const imageFileName = "P" + photoCounter; + const updateUserFileJson = { + FileName: fileName, + FileUrl: fileUrl, + LastModified: lastModified, + Size: size, + Date: date, + Time: time, + OrgFileDocumentName: orgFileDocumentName, + BasePath: basePath, + FileStatus: "OK", + }; + setPostImages(updateUserFileJson, postId, imageFileName); + }).catch((error) => { + status = 500; + console.log("Error:", error); + }); + + Promise.resolve(promise).then(() => { + result = { data: { status: "OK" } }; + console.log("Image Uploaded Successfully"); + return response.status(status).send(result); + }) + .catch((error) => { + result = { data: error }; + console.error("Error Uploading Image", error); + return response.status(status).send(result); + }); +}; - Promise.resolve(promise).then(() => { - result = { data: { status: "OK" } }; - console.log("Image Uploaded Successfully"); - return response.status(status).send(result); - }) - .catch((error) => { - result = { data: error }; - console.error("Error Uploading Image", error); - return response.status(status).send(result); - }); - }; - \ No newline at end of file diff --git a/functions/model/performanceChart/tark/getPerformanceChartData.js b/functions/model/performanceChart/tark/getPerformanceChartData.js index 7fb584130..b723b40f4 100644 --- a/functions/model/performanceChart/tark/getPerformanceChartData.js +++ b/functions/model/performanceChart/tark/getPerformanceChartData.js @@ -66,7 +66,7 @@ exports.getPerformanceChartData = function(request, response) { const j=i.slice(1); if (j>=sprintRange1 && j<=sprintRange2) { responseData.push([i, doc[i]]); - } + } } console.log(responseData); result = { data: { status: "OK", data: responseData } }; diff --git a/functions/model/socialPage/lib.js b/functions/model/socialPage/lib.js index f2e64388e..0656f8b60 100644 --- a/functions/model/socialPage/lib.js +++ b/functions/model/socialPage/lib.js @@ -1,4 +1,5 @@ /* eslint-disable linebreak-style */ +/* eslint-disable valid-jsdoc */ /* eslint-disable object-curly-spacing */ /* eslint-disable eol-last */ /* eslint-disable indent */ @@ -53,7 +54,7 @@ exports.setPost = function(uid, post, postId, lastUpdatedDate, lastUpdatedTime, */ exports.getAllPosts = function() { const query = db.collection("Social"); - const getAllPosts = query.where("Status","==","OK").get(); + const getAllPosts = query.where("Status", "==", "OK").get(); return Promise.resolve(getAllPosts); }; diff --git a/functions/model/socialPage/tark/deletePost.js b/functions/model/socialPage/tark/deletePost.js index 8ed9a2e24..a8c542837 100644 --- a/functions/model/socialPage/tark/deletePost.js +++ b/functions/model/socialPage/tark/deletePost.js @@ -15,42 +15,40 @@ ***********************************************************/ const {deleteUserPost, getPost} = require("../lib"); const {getUser, updateUser} = require("../../users/lib"); - + exports.deletePost = function(request, response) { const uid = request.body.data.Uid; const postId = request.body.data.PostId; let result; let status = 200; - + const promise = getUser(uid, "").then((doc) => { const p1 = getPost(postId).then((postData) => { - if (postData == undefined) { - result = {data: {status: "Post doesn't exist"}}; - } else { - const updatePostToJson = { - Status: "DELETED", - }; - deleteUserPost(updatePostToJson,postId); - + if (postData == undefined) { + result = {data: {status: "Post doesn't exist"}}; + } else { + const updatePostToJson = { + Status: "DELETED", + }; + deleteUserPost(updatePostToJson, postId); + } + }).catch((error) => { + status = 500; + console.log("Error:", error); + }); - } - }).catch((error) => {s - status = 500; - console.log("Error:", error); + return Promise.resolve(p1); + }); + + Promise.resolve(promise).then(() => { + result = {data: {status: "OK"}}; + console.log("Post Deleted Successfully"); + return response.status(status).send(result); + }) + .catch((error) => { + result = {data: error}; + console.error("Error Deleting", error); + return response.status(status).send(result); }); - - return Promise.resolve(p1); - }); - - Promise.resolve(promise).then(() => { - result = {data: {status: "OK"}}; - console.log("Post Deleted Successfully"); - return response.status(status).send(result); - }) - .catch((error) => { - result = {data: error}; - console.error("Error Deleting", error); - return response.status(status).send(result); - }); -}; \ No newline at end of file +};