Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Conversation

@shane-tomlinson
Copy link

@shane-tomlinson shane-tomlinson commented Mar 20, 2019

server.js has a whole bunch of mixed concerns, part of which was record retrieval
and loading/checking user defined rules.

This PR extracts record handling logic as well as user defined rules logic
into their own modules.

Loading/saving records can now be done through a common interface. fetchRecords no longer
holds the assumption that an ip address will be passed in. setRecord no longer requires
passing in a key as the key is stored on the record, and setRecords now only accepts records
instead of it's confusing signature. It's now possible to define non-enumerable
properties on a record that are not saved when serialized.

I started to use async/await to simplify logic where it made sense as well as
started down the path to using native promises in places.

Note, no remote tests are modified, so functionality should be the same.

This is groundwork to simplify the DataFlow integration where a simple API is
needed to fetch records of varying types.

@mozilla/fxa-devs - r?

blocks #325

@shane-tomlinson shane-tomlinson requested a review from a team March 20, 2019 12:43
@ghost ghost assigned shane-tomlinson Mar 20, 2019
@ghost ghost added the waffle:active label Mar 20, 2019
@shane-tomlinson shane-tomlinson force-pushed the refactor-simplify-record-management branch from f6c85f7 to b8e33cc Compare March 20, 2019 12:57
Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shane-tomlinson This is pretty cool, I have some basic comments but looks like there was some breakage in tests.

* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

module.exports = function (config, fetchRecord, setRecord) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling this out!

@shane-tomlinson shane-tomlinson force-pushed the refactor-simplify-record-management branch 10 times, most recently from 5a86e7a to 7467466 Compare March 21, 2019 10:54
… defined rules.

server.js has a whole bunch of mixed concerns, part of which was record retreival
and loading/checking user defined rules.

This PR extracts record handling logic as well as user defined rules logic
into their own modules.

Loading/saving records can now be done through a common interface. fetchRecords no longer
holds the assumption that an ip address will be passed in. setRecord no longer requires
passing in a key as the key is stored on the record, and setRecords now only accepts records
instead of it's confusing signature.  It's now possible to define non-enumerable
properties on a record that are not saved when serialized.

I started to use async/await to simplify logic where it made sense as well as
started down the path to using native promises in places.

Note, no remote tests are modified, so functionality should be the same.

This is groundwork to simplify the DataFlow integration where a simple API is
needed to fetch records of varying types.
@shane-tomlinson shane-tomlinson force-pushed the refactor-simplify-record-management branch from 7467466 to 6f73c3c Compare March 21, 2019 12:29
Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shane-tomlinson Looks solid, r+!

@shane-tomlinson shane-tomlinson merged commit bfd53d0 into master Mar 21, 2019
@shane-tomlinson shane-tomlinson deleted the refactor-simplify-record-management branch March 21, 2019 19:34
@ghost ghost removed the waffle:review label Mar 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants