# Accept task

acceptedByDeveloper

### Input parameters

* TaskID

### How to call from app

HTTP request to: /accept-task/TASKID

```
import { httpsCallable } from 'firebase/functions';

await httpsCallable(functions, 'acceptTask')({ 
    taskId: task.id,
    complexityRange: Number(currentTask.complexityRange),
    timeRange: Number(currentTask.timeRange)
})
```

### Logic

1. The frontend (app.tasksource.io) calls the API (api.tasksource.io/acceptTask/TASK-ID)

2. the backend should now set a field in the task document (acceptedByDeveloper = true)

3. Send First Email:

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

4. Send Second Email:
   * to\_email\_adress = email\_of\_task\_creator
   * template\_name = "tasks-accepted-by-developer->creator"
   * data = {taskData: taskData, taskId: taskId}
