create static method
Assign a task to a user
This method creates a new assign document and updates the 'assignTo' field of the task document.
See the README.en.md for details.
Implementation
static Future<DocumentReference> create({
required String uid,
required String taskId,
}) async {
final ref = await TodoService.instance.assignCol.add({
'uid': uid,
'taskId': taskId,
'status': AssignStatus.waiting,
'createdAt': FieldValue.serverTimestamp(),
});
await TodoService.instance.taskCol.doc(taskId).update({
'assignTo': FieldValue.arrayUnion([uid]),
});
return ref;
}