pawelgrimm/pomi

When a session is created without a new task/project, report existing incomplete tasks/active projects that match the provided task/project title.

Opened this issue · 0 comments

HTTP response should trigger UI popup to either select the existing task/project or to create a duplicate with the same name. Could be implemented with a new "confirmExisting=true" body parameter

Imagined flow:

if (project.title) {
  const foundProject = await Projects.selectBy({title: project.title});
  if (foundProject) {
    project = foundProject;
  } else {
    return {}; // Create new project and task
  }
}
// now we have a project Id AND we know we don't "need" a new project
if (task.title) {
  const foundTask = await Tasks.selectBy({title: task.title, project_id: project.id});
  if (foundTask) {
    task = foundTask;
    return { project, task }; // Ask user if existing project should be used, then ask if existing task should be used
  } else {
    return { project }; // Create new task // Ask user if existing project should be used, create a new task
}