rename 'routes' in blueprints to 'resources'

routes was a confusing semantics that was not in order with the rest of the architecture
This commit is contained in:
Lachlan Kermode
2018-12-07 12:32:32 +00:00
parent 565a36083f
commit 8a5bce0842
10 changed files with 45 additions and 39 deletions

View File

@@ -25,7 +25,6 @@ class Controller {
return this.fetchers[sheet].update()
})
).then(results => {
console.log(results)
if (results.every(r => r)) {
return copy.success.update
} else {

View File

@@ -47,7 +47,10 @@ class Fetcher {
* performance of indexing the blueprints.
*/
this.blueprints = this._indexDbForBlueprints()
.then(res => res)
.then(allUrls => {
const supportedUrls = allUrls.filter(url => url.startsWith(this.id))
return {}
})
/*
* Google API setup
@@ -71,8 +74,8 @@ class Fetcher {
)
return Promise.all(
Object.keys(saturatedBp.routes).map(route =>
this.db.save(`${this.id}/${tab}/${route}`, saturatedBp.routes[route].data)
Object.keys(saturatedBp.resources).map(route =>
this.db.save(`${this.id}/${tab}/${route}`, saturatedBp.resources[route].data)
)
)
}
@@ -106,7 +109,7 @@ class Fetcher {
update () {
let tabTitles
/* Retrieve all available routes on a given sheet, and store formatted copies of it where a formatter is available */
/* Retrieve all available resources on a given sheet, and store formatted copies of it where a formatter is available */
return this.API.spreadsheets
.get({
auth: this.auth,

View File

@@ -5,7 +5,7 @@ export const defaultBlueprint = {
name: null,
id: null,
dialects: ['rest'], // supported dialects, can (eventually) be multiple
routes: {}
resources: {}
}
export const defaultRoute = {

View File

@@ -77,11 +77,11 @@ export function desaturate (full) {
name: R.clone(full.name),
sheet: R.clone(full.sheet),
dialects: R.clone(full.dialects),
routes: {}
resources: {}
}
Object.keys(full.routes).forEach(route => {
blueprint.routes[route] = {
options: R.clone(full.routes[route].options)
Object.keys(full.resources).forEach(route => {
blueprint.resources[route] = {
options: R.clone(full.resources[route].options)
}
})
return blueprint