# Reject work result

### Input parameters

* ```
  taskId
  ```
* ```
  rejectionReason
  ```

### How to call from app

HTTP request to: /reject-work-result/TASKID

<pre><code>import { httpsCallable } from 'firebase/functions';

<strong>await httpsCallable(functions, 'rejectWorkResult')({ 
</strong>    taskId: task.id,
    rejectionReason: currentTask.rejectionReason,
})
</code></pre>

### Logic

1. The frontend (app.tasksource.io) calls the API (/reject-work-result/TASK-ID)

2. the backend should now set a field in the task document (workResultIsAccepted = false) as well as the (workResultRejectionReason = workResultRejectionReason)  field and the (submittedForReview = false)

3. Send First Email:

   * to\_email\_adress = email\_of\_assigned\_person
   * template\_name = "work-result-rejected->developer"
   * data = {taskData: taskData, taskId: taskId, rejectionReason: rejectionReason}

4. ~~Send Second Email:~~
   * ~~to\_email\_adress = email\_of\_task\_creator~~
   * ~~template\_name = "work-result-rejected->creator"~~
   * ~~data = {taskData: taskData, taskId: taskId, rejectionReason: rejectionReason}~~
