This repository was archived by the owner on Apr 3, 2019. It is now read-only.
refactor(server): Extract and simplify record retreival/storage, user defined rules.#324
Merged
shane-tomlinson merged 1 commit intomasterfrom Mar 21, 2019
Merged
Conversation
f6c85f7 to
b8e33cc
Compare
vbudhram
reviewed
Mar 20, 2019
Contributor
vbudhram
left a comment
There was a problem hiding this comment.
@shane-tomlinson This is pretty cool, I have some basic comments but looks like there was some breakage in tests.
lib/user_defined_rules.js
Outdated
| * 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) { |
Contributor
There was a problem hiding this comment.
Thanks for pulling this out!
5a86e7a to
7467466
Compare
… 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.
7467466 to
6f73c3c
Compare
vbudhram
approved these changes
Mar 21, 2019
Contributor
vbudhram
left a comment
There was a problem hiding this comment.
@shane-tomlinson Looks solid, r+!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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