Skip to content

Commit

Permalink
fix: ESLint errors in release
Browse files Browse the repository at this point in the history
  • Loading branch information
Pendyala-thanvi committed Aug 13, 2022
1 parent 4571e12 commit 84beba4
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 80 deletions.
1 change: 1 addition & 0 deletions functions/model/librarian/librarian.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable linebreak-style */
/* eslint-disable no-undef */
/* eslint-disable object-curly-spacing */
/* eslint-disable eol-last */
/* eslint-disable indent */
Expand Down
99 changes: 50 additions & 49 deletions functions/model/librarian/tark/uploadPostImages.js
Original file line number Diff line number Diff line change
@@ -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 */
Expand All @@ -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);
});
};

Original file line number Diff line number Diff line change
Expand Up @@ -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 } };
Expand Down
3 changes: 2 additions & 1 deletion functions/model/socialPage/lib.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable linebreak-style */
/* eslint-disable valid-jsdoc */
/* eslint-disable object-curly-spacing */
/* eslint-disable eol-last */
/* eslint-disable indent */
Expand Down Expand Up @@ -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);
};

Expand Down
56 changes: 27 additions & 29 deletions functions/model/socialPage/tark/deletePost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};
};

0 comments on commit 84beba4

Please sign in to comment.