👨‍💻Assign Task

Assigne task documetation

Input parameters

  • TaskID

  • Email-Adress of Assigned member

How to call from app

import { httpsCallable } from 'firebase/functions';

await httpsCallable(functions, 'assignTask')({ taskId, email })

Logic

Miro: https://miro.com/app/board/uXjVPbexhys=/?share_link_id=959063091369

As a user, i want to assign tasks directly to an email address.

How to check if user exists? Checkout: https://stackoverflow.com/questions/51562995/how-can-i-check-if-user-exists-in-firebase

TO BE CONTINUED!!!

If the user with email address exists: {

  1. get uid of user by Email adress

  2. get user document in DB (users/uid)

    1. add the ProjectId to the thirdPartyProjects array

    2. Then add the taskId to the assignedTasks array

}

  1. Changes in the Project (/projects/projectId)

    • Change the databaseStatus of the task in the project document to "assigned".

    • Add the email address of the assigned person to members array

    • add a field to the tasks array element that has the TaskId "assignedTo" add the uid as value

2. Add user email to "projects/{projectId}/members" array

3. Move the Tasks from its previous position to here: (/tasks/assigned/all/taskId) and delete the copy in the old database position.

3. Add user (developer) email to "tasks/{taskId}.assignToEmail"

If the user with email address exists: {

4. Send First Email:

  • to_email_adress = email_of_assigned_person

  • template_name = "tasks-assigned->developer"

  • data = {taskData: taskData, taskId: taskId}

}

If the user with email address does NOT exists: {

Send Emial:

  • to_email_adress = email_of_assigned_person

  • template_name = "tasks-assigned->new-user"

  • data = {taskData: taskData, taskId: taskId}

}

5. Send Second Email:

  • to_email_adress = email_of_task_creator

  • template_name = "tasks-assigned->creator"

  • data = {taskData: taskData, taskId: taskId}

Last updated