Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Implement SettingsSchema.sites. #33

Merged
merged 6 commits into from Jul 3, 2017
Merged

Implement SettingsSchema.sites. #33

merged 6 commits into from Jul 3, 2017

Conversation

jcjimenez
Copy link
Contributor

@jcjimenez jcjimenez commented Jul 3, 2017

graphql

Copy link
Contributor

@Smarker Smarker left a comment

Choose a reason for hiding this comment

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

LGTM with comments

return reject(`Could not find site with id ${siteId}`);
}
if (rows.length > 1) {
return reject(`Got more than one (${rows.length}) site with id ${siteId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

This reject's statement might get confusing (suppose rows.length is 3 and siteId is 1):
Got more than one 3 site with id 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good, point! But I think we should be safe since it will look more like this:

Got more than one (2) site with id d4d294ec-5b2c-4674-8f3f-e1eb7b8dbb47

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I agree - let me work on making that more readable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yea you are right! Didn't see the parentheses.

const siteCollection = Object.assign({}, {runTime: '' + (Date.now() - startTime), sites: [ site ]});
resolve(siteCollection);
})
.catch(err => reject(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also do catch(reject); here.

Copy link
Contributor

@c-w c-w left a comment

Choose a reason for hiding this comment

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

LGTM

// .catch(err => reject(err))
.then(rows => {
if (rows.length < 1) {
return reject(`Could not find site with id ${siteId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: could inline the return-reject like elsewhere if (...) return reject(...)

}

const site = cassandraRowToSite(rows[0]);
const siteCollection = Object.assign({}, {runTime: '' + (Date.now() - startTime), sites: [ site ]});
Copy link
Contributor

Choose a reason for hiding this comment

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

This is implemented more generally in #34.

@jcjimenez jcjimenez merged commit 768999a into CatalystCode:master Jul 3, 2017
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.

None yet

3 participants