farmOS / farmOS.js

A JavaScript library for working with farmOS data structures and interacting with farmOS servers.
MIT License
15 stars 13 forks source link

Use field transforms on all 'date-time' formats. #64

Closed jgaehring closed 2 years ago

jgaehring commented 2 years ago

As I mentioned in the Coffee Shop issue on subrequests, I realized not all timestamps were being transformed by the adapter to the format Drupal JSON:API accepts. Regardless of when and how those changes concerning subrequests get merged, however, this commit should be merged sooner rather than later, so I rebased this to the first of those commits and have split it off as its own feature branch to merge.

Basically, I've just renamed generateFilterTransforms() to generateFieldTransforms() and filterTransforms to fieldTransforms to indicate their more general use now,. Then those fieldTransforms, which are just a collection of transformation functions to be applied to field or filter values, are passed as the third parameter to transformLocalEntity, which uses them to transform data on .send() requests as well.

This is a nice pattern that can probably be applied elsewhere in adapter.js, but for now this is all we need.