openlawlibrary / stelae

Preservation, Authentication, Access
GNU Affero General Public License v3.0
7 stars 1 forks source link

refact: optimize stelae database by hashing composite keys; small ergonomic improvements #44

Closed n-dusan closed 3 months ago

n-dusan commented 3 months ago

Closes #39

A couple of notable changes:

Database improvements.

Ergonomics and QoL improvements:

n-dusan commented 3 months ago

Thanks for the review. My thought for traits is that they were a convenient way of mapping out all the queries, because then we can mock/test the database queries in our testing framework. Do you think there might be a better way of doing it? I'll test my hypothesis by adding tests hopefully in the near future!

tombh commented 3 months ago

Ah yes, traits make sense for testing. I can't say I've ever actually mocked DB calls, in any language. What are the advantages? I suppose the main one is that it speeds up tests? It seems a bit brittle to me, that the mocked responses could become stale, creating false positives. And that some extra coverage is gained by testing against a real database.

But anyway, using traits to aid tests is a legitimate use case, so all good.