Skip to content

Add an audit plugin. #264

@allanchau

Description

@allanchau

Is your feature request related to a problem? Please describe.
We have been inconsistently implementing a modifiedBy (and others) reference field across numerous projects. This is causing an unintended side effect of slowing down the list view due to multiple queries to go and grab the reference value.

Describe the solution you'd like
Create a mongoose plugin that:

  • Automatically adds modifiedBy, createdBy, dateModified, dateCreated fields.
  • The ...By fields should be objectids referencing the linz user model.
  • The date... fields should be date fields.
  • These fields should be hidden and disabled from all forms by default. This includes things like exports and filters.

By doing this we can populate the field so that only 1 query is needed.

Describe alternatives you've considered
We can implement this per project, but I think it is something that would be useful as an audit across all projects.

Additional context
Add mongoose.set('debug', true); to a project which uses the modifiedBy and view the mongo logs. There should be 1 additional query per line.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions