Since Authentication is not there i'm displaying as two different page one for complains and other for police login
Run the project --> npm run dev
- On Login of the Officer we are assigning the un-assigned complains to his bucket in the backend.
- On Creating complains we are checking the officers that are online and not having a complain assined already, then we are assigning the complain to that officer.
- When we change the complain status to completed, we are un-assigning that complain from the officer making his bucket empty for other cases.
We can create lambda in AWS that will trigger after some interval by the cron, that will take care of this assigning and unassigning of the complains.
/api/signin
/api/register
/api/logout/api/:id
/api/complains
/api/complain
/api/complains/:id
/police/assign/:id
CREATE extension "uuid-ossp";
CREATE TABLE IF NOT EXISTS complains (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
car_model text NOT NULL,
customer_name VARCHAR(100) NOT NULL,
customer_phone_number text NOT NULL,
notes jsonb,
is_completed BOOLEAN DEFAULT FALSE NOT NULL,
created_at TIMESTAMP without time zone NOT NULL,
CONSTRAINT complains_pkey PRIMARY KEY ( id )
);
CREATE TABLE IF NOT EXISTS users (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
name VARCHAR(100),
email text UNIQUE NOT NULL,
hash VARCHAR(100) NOT NULL,
created_at TIMESTAMP without time zone DEFAULT now() NOT NULL,
CONSTRAINT users_pkey PRIMARY KEY ( id ),
fk_complains_id uuid references complains (id)
);
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS complains;
- To change the complain status we have to click on yellow button
- To Assign and Unassign complains, we have to click on Pickup/Unassign button
Card CSS - https://codepen.io/alvaromontoro/pen/ebPEWb Profile Card CSS - https://codepen.io/msichterman/pen/zVmEpG Barebones - https://github.com/covalence-io/barebones-react-typescript-express