INNER CODE UNIT · TypeScript
beginTaskResolution
dtinth/todo-actions · src/DataStore.ts:25
export async function beginTaskResolution(
todoUniqueKey: string,
repositoryId: string,
todo: ITodo,
): Promise<TaskResolutionProcedure> {
const db = await getMongoDb()
const _id = ObjectId.createFromHexString(todoUniqueKey)
// Ensure a task exists in the database.
const task = await db.tasks.findOneAndUpdate(
{ _id: _id },
{
$setOnInsert: {
_id: _id,
repositoryId: repositoryId,
taskReference: null,
createdAt: new Date(),
ownerProcessId: null,