DEFRA / water-abstraction-team

Guides, info and issue management for the Water Abstraction Team
Other
1 stars 0 forks source link

Move UUID generation to single place #96

Closed Cruikshanks closed 10 months ago

Cruikshanks commented 1 year ago

There are a number of places in water-abstraction-system where we need to generate a UUID. This is what the records in the DB use for their primary keys. We generate them in tests, for performance reasons (reduce hits on the DB) or simply because the previous team forgot to set the table to automatically generate them!

You have to require() the module and then it's a one-liner to generate the method. So, moving it to our own thing didn't seem necessary.

But there is some config you need to apply, and we have duplicated that in a number of places. Who knows where a new dev will encounter randomUUID({ disableEntropyCache: true }) for the first time! 😆

Admittedly, it's borderline whether there is value in doing this. But we've come to the conclusion we should.

Cruikshanks commented 10 months ago

This is done!