# Deadline reached

### Input parameters

* TaskID

### How trigger

function should trigger automatic when task deadline is reached.

### Logic

1. The backend should unassign a task after 48 hours if the Task is not accepted by deveoper.. (Probably not a http callable)
2. <mark style="color:green;">get developer document in DB (users/uid)</mark>&#x20;
   1. <mark style="color:green;">remove the</mark> <mark style="color:green;"></mark><mark style="color:green;">**ProjectId**</mark> <mark style="color:green;"></mark><mark style="color:green;">to the</mark> <mark style="color:green;"></mark><mark style="color:green;">**thirdPartyProjects**</mark> <mark style="color:green;"></mark><mark style="color:green;">array</mark>
   2. <mark style="color:green;">Then remove  the</mark> <mark style="color:green;"></mark><mark style="color:green;">**taskId**</mark> <mark style="color:green;"></mark><mark style="color:green;">to the</mark> <mark style="color:green;"></mark><mark style="color:green;">**assignedTasks**</mark> <mark style="color:green;"></mark><mark style="color:green;">array</mark>
3. the task could then be changed back to submitted or drafts, depending on isAssignedToPool boolean.
4. Send an Email to developer and Creator:

* Send First Email:

  * to\_email\_adress = email\_of\_assigned\_person
  * template\_name = "tasks-accept-deadline-reached->developer"
  * data = {taskData: taskData, taskId: taskId}

* Send Second Email:
  * to\_email\_adress = email\_of\_task\_creator
  * template\_name = "tasks-accept-deadline-reached->creator"
  * data = {taskData: taskData, taskId: taskId}
