use of org.collectiveone.common.dto.PostResult in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method moveSectionSubsection.
@RequestMapping(path = "/initiative/{initiativeId}/model/section/{sectionId}/moveSubsection/{subsectionId}", method = RequestMethod.PUT)
public PostResult moveSectionSubsection(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("sectionId") String sectionIdStr, @PathVariable("subsectionId") String subsectionIdStr, @RequestParam(name = "onViewId", defaultValue = "") String onViewIdStr, @RequestParam(name = "onSectionId", defaultValue = "") String onSectionIdStr, @RequestParam(name = "onSubsectionId") String onSubsectionIdStr) {
if (getLoggedUser() == null) {
return new PostResult("error", "endpoint enabled users only", null);
}
UUID initiativeId = UUID.fromString(initiativeIdStr);
if (governanceService.canEditModel(initiativeId, getLoggedUser().getC1Id()) == DecisionVerdict.DENIED) {
return new PostResult("error", "not authorized", "");
}
/* dropped on view can be empty */
UUID onViewId = onViewIdStr.equals("") ? null : UUID.fromString(onViewIdStr);
/* dropped on section can be empty */
UUID onSectionId = onSectionIdStr.equals("") ? null : UUID.fromString(onSectionIdStr);
/* dropped on subsection can be empty */
UUID onSubsectionId = onSubsectionIdStr.equals("") ? null : UUID.fromString(onSubsectionIdStr);
return modelService.moveSubsection(UUID.fromString(sectionIdStr), UUID.fromString(subsectionIdStr), onViewId, onSectionId, onSubsectionId, getLoggedUserId());
}
use of org.collectiveone.common.dto.PostResult in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method moveViewSection.
@RequestMapping(path = "/initiative/{initiativeId}/model/view/{viewId}/moveSection/{sectionId}", method = RequestMethod.PUT)
public PostResult moveViewSection(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("viewId") String viewIdStr, @PathVariable("sectionId") String sectionIdStr, @RequestParam(name = "onViewSectionId", defaultValue = "") String onViewSectionIdStr, @RequestParam(name = "onSectionId", defaultValue = "") String onSectionIdStr, @RequestParam(name = "onSubsectionId", defaultValue = "") String beforeSubsectionIdStr) {
if (getLoggedUser() == null) {
return new PostResult("error", "endpoint enabled users only", null);
}
UUID initiativeId = UUID.fromString(initiativeIdStr);
if (governanceService.canEditModel(initiativeId, getLoggedUser().getC1Id()) == DecisionVerdict.DENIED) {
return new PostResult("error", "not authorized", "");
}
/* dropped on viewSection can be empty*/
UUID onViewSectionId = onViewSectionIdStr.equals("") ? null : UUID.fromString(onViewSectionIdStr);
/* dropped on section can be empty*/
UUID onSectionId = onSectionIdStr.equals("") ? null : UUID.fromString(onSectionIdStr);
/* dropped on subsection can be empty*/
UUID onSubsectionId = beforeSubsectionIdStr.equals("") ? null : UUID.fromString(beforeSubsectionIdStr);
return modelService.moveSection(UUID.fromString(viewIdStr), UUID.fromString(sectionIdStr), onViewSectionId, onSectionId, onSubsectionId, getLoggedUserId());
}
use of org.collectiveone.common.dto.PostResult in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method moveView.
@RequestMapping(path = "/initiative/{initiativeId}/model/moveView/{viewId}", method = RequestMethod.PUT)
public PostResult moveView(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("viewId") String viewIdStr, @RequestParam(name = "onViewId", defaultValue = "") String onViewIdStr) {
if (getLoggedUser() == null) {
return new PostResult("error", "endpoint enabled users only", null);
}
UUID initiativeId = UUID.fromString(initiativeIdStr);
if (governanceService.canEditModel(initiativeId, getLoggedUser().getC1Id()) == DecisionVerdict.DENIED) {
return new PostResult("error", "not authorized", "");
}
/* dropped on viewSection can be empty*/
UUID onViewId = onViewIdStr.equals("") ? null : UUID.fromString(onViewIdStr);
return modelService.moveView(initiativeId, UUID.fromString(viewIdStr), onViewId, getLoggedUserId());
}
use of org.collectiveone.common.dto.PostResult in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method setCardLike.
@RequestMapping(path = "/initiative/{initiativeId}/model/card/{cardWrapperId}/like", method = RequestMethod.PUT)
public PostResult setCardLike(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("cardWrapperId") String cardWrapperIdStr, @RequestParam("likeStatus") Boolean likeStatus) {
if (getLoggedUser() == null) {
return new PostResult("error", "endpoint enabled users only", null);
}
// UUID initiativeId = UUID.fromString(initiativeIdStr);
UUID cardWrapperId = UUID.fromString(cardWrapperIdStr);
Initiative initiative = modelService.getCardWrapperInitiative(cardWrapperId);
if (!initiativeService.isMemberOfEcosystem(initiative.getId(), getLoggedUserId())) {
return new PostResult("error", "not authorized", "");
}
return modelService.setLikeToCard(cardWrapperId, getLoggedUserId(), likeStatus);
}
use of org.collectiveone.common.dto.PostResult in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method moveExistingCard.
@RequestMapping(path = "/initiative/{initiativeId}/model/section/{sectionId}/moveCard/{cardWrapperId}", method = RequestMethod.PUT)
public PostResult moveExistingCard(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("sectionId") String fromSectionIdStr, @PathVariable("cardWrapperId") String cardWrapperIdStr, @RequestParam(name = "onSectionId") String onSectionIdStr, @RequestParam(name = "onCardWrapperId") String onCardWrapperIdStr) {
if (getLoggedUser() == null) {
return new PostResult("error", "endpoint enabled users only", null);
}
UUID initiativeId = UUID.fromString(initiativeIdStr);
if (governanceService.canEditModel(initiativeId, getLoggedUser().getC1Id()) == DecisionVerdict.DENIED) {
return new PostResult("error", "not authorized", "");
}
/* dropped on card can be empty */
UUID onCardWrapperID = null;
if (!onCardWrapperIdStr.equals("")) {
onCardWrapperID = UUID.fromString(onCardWrapperIdStr);
}
return modelService.moveCardWrapper(UUID.fromString(fromSectionIdStr), UUID.fromString(cardWrapperIdStr), UUID.fromString(onSectionIdStr), onCardWrapperID, getLoggedUserId());
}
Aggregations