-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #655 from Worktez/dev-angular
Internal Release 6.3
- Loading branch information
Showing
24 changed files
with
517 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* eslint-disable linebreak-style */ | ||
/* eslint-disable max-len */ | ||
/* eslint-disable no-trailing-spaces */ | ||
/* eslint-disable object-curly-spacing */ | ||
/* eslint-disable no-unused-vars */ | ||
/** ********************************************************* | ||
* Copyright (C) 2022 | ||
* Worktez | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the MIT License | ||
* | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the MIT License for more details. | ||
***********************************************************/ | ||
|
||
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; | ||
|
||
let result; | ||
let status = 200; | ||
|
||
const promise = getPost(postId).then((data) => { | ||
let photoCounter = data.TotalPhotoCounter; | ||
photoCounter++; | ||
|
||
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); | ||
}); | ||
|
||
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); | ||
}); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-disable linebreak-style */ | ||
/* eslint-disable no-unused-vars */ | ||
/** ********************************************************* | ||
* Copyright (C) 2022 | ||
* Worktez | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the MIT License | ||
* | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the MIT License for more details. | ||
***********************************************************/ | ||
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); | ||
|
||
|
||
} | ||
}).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); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.