Skip to content

Commit

Permalink
Merge pull request #113 from Prometheus7-creator/multitenant
Browse files Browse the repository at this point in the history
edit location bug fix
  • Loading branch information
abhinovpankaj authored Mar 30, 2024
2 parents bda064b + 394584f commit d637006
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions service/invasiveUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ const markLocationNonInvasive = async (locationid) => {
await LocationDAO.editLocation(locationid, location);


await updateParentHelper.removeLocationFromParent(locationid, location);
await updateParentHelper.addLocationMetadataInParent(locationid, location);
// await updateParentHelper.removeLocationFromParent(locationid, location);
await updateParentHelper.addUpdateLocationMetadataInParent(locationid, location);

if (location.parenttype == "subproject") {
await markSubProjectNonInvasive(location.parentid);
Expand Down Expand Up @@ -155,8 +155,8 @@ const markSubProjectNonInvasive = async (subProjectId) => {
subProject.isInvasive = false;
await SubProjectDAO.editSubProject(subProjectId, subProject);

await updateParentHelper.removeSubprojectMetaDataInProject(subProjectId, subProject);
await updateParentHelper.addSubprojectMetaDataInProject(subProjectId, subProject);
// await updateParentHelper.removeSubprojectMetaDataInProject(subProjectId, subProject);
await updateParentHelper.addUpdateSubprojectMetaDataInProject(subProjectId, subProject);

if (subProject.parenttype == "project") {
await markProjectNonInvasive(subProject.parentid);
Expand Down
22 changes: 21 additions & 1 deletion service/updateParentHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,25 @@ const addSubprojectMetaDataInProject = async (subProjectId, subProject) => {
);
};

const addUpdateSubprojectMetaDataInProject = async (subProjectId, subProject) => {
const subProjectDataInParent = {
name: subProject.name,
type: "subproject",
url: subProject.url,
description: subProject.description,
isInvasive: subProject.isInvasive,
sequenceNo: subProject.sequenceNo !== undefined ? subProject.sequenceNo : null,
};
await ProjectDAO.addUpdateProjectChild(
subProject.parentid,
subProjectId,
subProjectDataInParent
);
console.log(
`Added subproject with id ${subProjectId} in project id ${subProject.parentid} successfully`
);
};

const removeSubprojectMetaDataInProject = async (subProjectId, subProject) => {
await ProjectDAO.removeProjectChild(subProject.parentid, subProjectId);
console.log(
Expand Down Expand Up @@ -225,5 +244,6 @@ module.exports = {
removeSubprojectMetaDataInProject,
addRemoveSubProjectMetadataInProject,
addUpdateLocationMetadataInParent,
addUpdateSectionMetadataFromParent
addUpdateSectionMetadataFromParent,
addUpdateSubprojectMetaDataInProject
};

0 comments on commit d637006

Please sign in to comment.