use of de.metas.ui.web.board.json.JSONBoardCard in project metasfresh-webui-api by metasfresh.
the class BoardRestController method patchCard.
@PatchMapping("/{boardId}/card/{cardId}")
public JSONBoardCard patchCard(@PathVariable("boardId") final int boardId, @PathVariable("cardId") final int cardId, @RequestBody final List<JSONDocumentChangedEvent> changes) {
userSession.assertLoggedIn();
final BoardCard card = boardsRepo.changeCard(boardId, cardId, createBoardCardChangeRequest(changes));
return JSONBoardCard.of(card, userSession.getAD_Language());
}
use of de.metas.ui.web.board.json.JSONBoardCard in project metasfresh-webui-api by metasfresh.
the class BoardRestController method addCard.
@PostMapping("/{boardId}/card")
public JSONBoardCard addCard(@PathVariable("boardId") final int boardId, @RequestBody final JSONBoardCardAddRequest request) {
userSession.assertLoggedIn();
final int position = request.getPosition() != null ? request.getPosition() : Integer.MAX_VALUE;
final BoardCard card = boardsRepo.addCardForDocumentId(boardId, request.getLaneId(), request.getDocumentId(), position);
invalidateAllNewCardsViews(boardId);
return JSONBoardCard.of(card, userSession.getAD_Language());
}
use of de.metas.ui.web.board.json.JSONBoardCard in project metasfresh-webui-api by metasfresh.
the class BoardRestController method getBoard.
@GetMapping("/{boardId}")
public JSONBoard getBoard(@PathVariable("boardId") final int boardId) {
userSession.assertLoggedIn();
final String adLanguage = userSession.getAD_Language();
final BoardDescriptor boardDescriptor = boardsRepo.getBoardDescriptor(boardId);
final Multimap<Integer, JSONBoardCard> cardsByLaneId = boardsRepo.getCards(boardId).stream().map(card -> JSONBoardCard.of(card, adLanguage)).collect(GuavaCollectors.toImmutableListMultimap(JSONBoardCard::getLaneId));
final JSONBoardBuilder jsonBoard = JSONBoard.builder().boardId(boardId).caption(boardDescriptor.getCaption().translate(adLanguage)).websocketEndpoint(boardDescriptor.getWebsocketEndpoint());
boardDescriptor.getLanes().values().stream().map(lane -> JSONBoardLane.builder().laneId(lane.getLaneId()).caption(lane.getCaption().translate(adLanguage)).cards(cardsByLaneId.get(lane.getLaneId())).build()).forEach(jsonBoard::lane);
return jsonBoard.build();
}
use of de.metas.ui.web.board.json.JSONBoardCard in project metasfresh-webui-api by metasfresh.
the class BoardRestController method getCard.
@GetMapping("/{boardId}/card/{cardId}")
public JSONBoardCard getCard(@PathVariable("boardId") final int boardId, @PathVariable("cardId") final int cardId) {
userSession.assertLoggedIn();
final BoardCard card = boardsRepo.getCard(boardId, cardId);
return JSONBoardCard.of(card, userSession.getAD_Language());
}
Aggregations