Description
This should be used for two things:
-
An admin can easily see what a user has been doing recently and use that to provide better support (or auditing). This would be included in the "Activity" panel in the admin page for a user (which is not yet implemented).
-
A user could use this to easily find a file they were recently working on, without having to worry about which project it was in. More generally, it gives them a nice map of what they recently did.
Implementation thoughts
The database has this table project_log
.
smc=# \d project_log
Table "public.project_log"
Column | Type | Collation | Nullable | Default
------------+-----------------------------+-----------+----------+---------
id | uuid | | not null |
project_id | uuid | | |
time | timestamp without time zone | | |
account_id | uuid | | |
event | jsonb | | |
Indexes:
"project_log_pkey" PRIMARY KEY, btree (id)
"project_log_project_id_idx" btree (project_id)
"project_log_time_idx" btree ("time") CLUSTER
Triggers:
change_2d2dc0c43c4beb41 AFTER INSERT OR DELETE OR UPDATE OF account_id, "time", event, project_id, id ON project_log FOR EACH ROW EXECUTE PROCEDURE change_2d2dc0c43c4beb41()
We would need to index the account_id column. We're very lucky though that it is a separate column already and not buried in some stupid JSONB!
Then make a query in db-scema.js for admins and for normal users that gives them their part of the project_log table, limited both (?) by time and number of entries (?).
I don't know where in the UI this would go for users. It's clear for admins though.