Workflows
After successfully creating this first application, it’s time to move forward and dive into workflows. The goal of the next application is to create a TODO list which can be modified by end users.
Here’s some sample data:
BEGIN;
CREATE ROLE todo_owner LOGIN;
GRANT todo_owner TO authenticator;
CREATE SCHEMA todo AUTHORIZATION todo_owner;
CREATE TABLE todo.t_todo
(
id serial PRIMARY KEY,
tstamp date DEFAULT now(),
todo_item text NOT NULL,
status text
);
INSERT INTO todo.t_todo (tstamp, todo_item, status)
VALUES
('2021-03-04',' Do the laundry', 'created'),
('2021-03-06',' Cut the grass', 'accepted'),
('2021-03-09',' Eat a steak', 'success'),
('2021-03-12',' Slaughter a chicken', 'rejected');
COMMIT;
For the sake of simplicity, the TODO list consists of just one table. What is noteworthy here is the last column: The status informs us about the state of an object. A task might have succeeded, failed or it might have been rejected.