add function to assign a Helper to a ticket
This commit is contained in:
parent
d17e40e56b
commit
8e44a5ea51
|
@ -72,6 +72,19 @@ class TicketService {
|
|||
return $this->resolveTicket($this->ticketMapper->insert($ticket));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function assign($id, $userId): array{
|
||||
$matrixUser = $this->getOrCreateUser($userId);
|
||||
$ticket = $this->ticketMapper->findTicket($id);
|
||||
$roomID= $ticket->getMatrixRoom();
|
||||
$this->matrix->setProperty($roomID, "upschooling.ticket", array(
|
||||
"matrixHelperUser" => $matrixUser->getMatrixUser()
|
||||
));
|
||||
$ticket->setMatrixHelperUser($matrixUser->getMatrixUser());
|
||||
return $this->resolveTicket($this->ticketMapper->update($ticket));
|
||||
}
|
||||
|
||||
public function update($id, $title, $content, $userId) {
|
||||
throw new Exception("Not implemented");
|
||||
}
|
||||
|
@ -93,7 +106,7 @@ class TicketService {
|
|||
$title = array_get($matrixTicketContent, "title", "Untitled");
|
||||
$description = array_get($matrixTicketContent, "description", "");
|
||||
$lastModified = $this->matrix->getLastEventDate($ticket->getMatrixRoom());
|
||||
$matrixHelperUserName = array_get($matrixTicketContent, "matrixHelperUserName", "nicht zugewiesen");
|
||||
$matrixHelperUser = array_get($matrixTicketContent, "matrixHelperUser", "nicht zugewiesen");
|
||||
$expirationDate = array_get($matrixTicketContent, "expiration date", "");
|
||||
return array(
|
||||
'ticketId' => $ticketId,
|
||||
|
@ -101,7 +114,7 @@ class TicketService {
|
|||
'lastModified' => $lastModified,
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'matrixHelferName' => $matrixHelperUserName,
|
||||
'matrixHelperUser' => $matrixHelperUser,
|
||||
'expirationDate' => $expirationDate
|
||||
);
|
||||
} catch (MatrixException | RoomNotFoundException $e) {
|
||||
|
|
Loading…
Reference in a new issue