Edit the Todo process
In src/org.ts, the organisation places Todo in the Operations department. It passes the organisation-wide Employee role and the department’s Manager role to the process:
const operations = new OrgUnit(org, "operations", { name: "Operations", type: "department",})const operations_manager = new Role(operations, "Manager", { name: "Manager",})
new Todo(operations, "todo", employee, operations_manager)Connect the two steps
Section titled “Connect the two steps”Open src/todo.ts. Each Form pairs a schema with the role responsible for the step. The browser entry tells the Dashboard where to load that same schema. The last line makes the employee’s form the start and the manager’s acknowledgement the end:
import { Form, type OrgUnit, Process, type Role } from "processfocus"import { completeTodoForm, createTodoForm } from "./todo-forms"
export class Todo extends Process { constructor(scope: OrgUnit, id: string, employeeRole: Role, managerRole: Role) { super(scope, id, { name: "Todo", purpose: "Simple task management process", })
const create_todo = new Form(this, "Create todo", { name: "Create new todo", form: createTodoForm, browser: { entrypoint: "src/todo-forms.ts", exportName: "createTodoForm" }, role: employeeRole, })
const complete_todo = new Form(this, "Complete todo", { name: "Complete and acknowledge", form: completeTodoForm, browser: { entrypoint: "src/todo-forms.ts", exportName: "completeTodoForm" }, role: managerRole, })
this.start(create_todo).end(complete_todo) }}Change the employee’s form
Section titled “Change the employee’s form”In src/todo-forms.ts, change the label on description to a question. Here’s the complete file after the edit:
import { Schema as ES } from "effect"import { FormLabel } from "processfocus/forms"
export const createTodoForm = ES.Struct({ title: ES.String.annotate({ [FormLabel]: "Title" }), description: ES.String.annotate({ [FormLabel]: "What needs to be done?" }),})
export const completeTodoForm = ES.Struct({})The employee sees What needs to be done?, but the answer is still stored as description. The manager can acknowledge the Todo without entering any more data because completeTodoForm has no fields. Save the file before building the Dashboard.