use of org.collectiveone.modules.initiatives.Initiative in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method getActivityUnderView.
@RequestMapping(path = "/activity/model/view/{viewId}", method = RequestMethod.GET)
public GetResult<Page<ActivityDto>> getActivityUnderView(@PathVariable("viewId") String viewIdStr, @RequestParam("page") Integer page, @RequestParam("size") Integer size, @RequestParam(name = "onlyMessages", defaultValue = "false") Boolean onlyMessages) {
UUID viewId = UUID.fromString(viewIdStr);
Initiative initiative = modelService.getViewInitiative(viewId);
if (!initiativeService.canAccess(initiative.getId(), getLoggedUserId())) {
return new GetResult<Page<ActivityDto>>("error", "access denied", null);
}
return modelService.getActivityResultUnderView(viewId, new PageRequest(page, size), onlyMessages);
}
use of org.collectiveone.modules.initiatives.Initiative in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method countCardLikes.
@RequestMapping(path = "/initiative/{initiativeId}/model/card/{cardWrapperId}/countLikes", method = RequestMethod.GET)
public GetResult<Integer> countCardLikes(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("cardWrapperId") String cardWrapperIdStr, @RequestParam(name = "onlyMessages", defaultValue = "false") Boolean onlyMessages) {
UUID cardWrapperId = UUID.fromString(cardWrapperIdStr);
Initiative initiative = modelService.getCardWrapperInitiative(cardWrapperId);
if (!initiativeService.canAccess(initiative.getId(), getLoggedUserId())) {
return new GetResult<Integer>("error", "access denied", null);
}
return modelService.countCardLikes(cardWrapperId);
}
use of org.collectiveone.modules.initiatives.Initiative in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method countMessagesUnderView.
@RequestMapping(path = "/initiative/{initiativeId}/model/view/{viewId}/countMessages", method = RequestMethod.GET)
public GetResult<Long> countMessagesUnderView(@PathVariable("initiativeId") String initiativeIdStr, @PathVariable("viewId") String viewIdStr, @RequestParam(name = "onlyMessages", defaultValue = "false") Boolean onlyMessages) {
UUID viewId = UUID.fromString(viewIdStr);
Initiative initiative = modelService.getViewInitiative(viewId);
if (!initiativeService.canAccess(initiative.getId(), getLoggedUserId())) {
return new GetResult<Long>("error", "access denied", null);
}
return modelService.countMessagesUnderView(viewId);
}
use of org.collectiveone.modules.initiatives.Initiative 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.modules.initiatives.Initiative in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method getActivityUnderSection.
@RequestMapping(path = "/activity/model/section/{sectionId}", method = RequestMethod.GET)
public GetResult<Page<ActivityDto>> getActivityUnderSection(@PathVariable("sectionId") String sectionIdStr, @RequestParam("page") Integer page, @RequestParam("size") Integer size, @RequestParam(name = "onlyMessages", defaultValue = "false") Boolean onlyMessages) {
UUID sectionId = UUID.fromString(sectionIdStr);
Initiative initiative = modelService.getSectionInitiative(sectionId);
if (!initiativeService.canAccess(initiative.getId(), getLoggedUserId())) {
return new GetResult<Page<ActivityDto>>("error", "access denied", null);
}
return modelService.getActivityResultUnderSection(sectionId, new PageRequest(page, size), onlyMessages);
}
Aggregations