Skip to content

Commit

Permalink
enhance: utilize updateTicket instead of making a new zapier functi…
Browse files Browse the repository at this point in the history
…on for update todo action
  • Loading branch information
kylemcshea committed Jul 24, 2024
1 parent 7b6950e commit 1c9dbc9
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions app/Domain/Tickets/Services/Tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -2114,54 +2114,6 @@ public function pollForUpdatedAccountTodos(): array|false
return $todos;
}

public function updateTodoUsingZapier($values): array
{
if (!isset($values['ticketId'])) {
error_log('we dont have a ticket ..');
return [
"message" => "Missing ticketId",
"status" => "error",
];
}

$currentTicket = $this->getTicket($values['ticketId']);

if (!$currentTicket) {
return [
"message" => "We do not have a ticket for id " . $values['ticketId'],
"status" => "error",
];
}

$values = array(
'id' => $values['ticketId'],
'headline' => $currentTicket->headline,
'editorId' => $values['editorId'] ?? "",
'status' => $values['status'] ?? "",
'milestoneid' => $values['milestoneid'] ?? "",
);

try {
$sucessfullyUpdated = $this->updateTicket($values);
if ($sucessfullyUpdated) {
return [
"message" => "Ticket updated successfully",
"status" => "success",
];
} else {
return [
"message" => "Ticket could not be updated",
"status" => "error",
];
}
} catch (\Exception $e) {
return [
"message" => "Ticket could not be updated. Reason: " . $e->getMessage(),
"status" => "error",
];
}
}

public function createMilestoneUsingZapier($values): array|bool
{
$values = array(
Expand Down

0 comments on commit 1c9dbc9

Please sign in to comment.