Implemented StackApiController Get Function.

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-13 19:29:39 -04:00
committed by Julius Härtl
parent dd1d4246fe
commit cfd9ab98c6
3 changed files with 36 additions and 4 deletions

View File

@@ -89,9 +89,19 @@ class StackService {
}
}
//TODO: Write this function so we can look up one stack id.
public function find($stackId) {
throw new \Exception('Not yet implemented');
$stack = $this->stackMapper->find($stackId);
$cards = $this->cardMapper->findAll($stackId);
foreach ($cards as $cardIndex => $card) {
$assignedUsers = $this->assignedUsersMapper->find($card->getId());
$card->setAssignedUsers($assignedUsers);
if (array_key_exists($card->id, $labels)) {
$cards[$cardIndex]->setLabels($labels[$card->id]);
}
$card->setAttachmentCount($this->attachmentService->count($card->getId()));
}
$stack->setCards($cards);
return $stack;
}
public function findAll($boardId) {