mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-10 20:38:32 +03:00
defaultRoute -> defaultResource
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import R from 'ramda'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
import { defaultBlueprint, defaultResource } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byColumn - generate a Blueprint from a data sheet by column. Each column
|
||||
@@ -9,7 +9,7 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
* @return {type} Blueprint
|
||||
* generated.
|
||||
*/
|
||||
function byColumn (tabName, sheetName, sheetId, data) {
|
||||
function columns (tabName, sheetName, sheetId, data) {
|
||||
// Define Blueprint props
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.sheet = {
|
||||
@@ -21,7 +21,7 @@ function byColumn (tabName, sheetName, sheetId, data) {
|
||||
// column names define resources
|
||||
const labels = data[0]
|
||||
labels.forEach(label => {
|
||||
bp.resources[label] = R.clone(defaultRoute)
|
||||
bp.resources[label] = R.clone(defaultResource)
|
||||
})
|
||||
|
||||
// remaining rows as data
|
||||
@@ -34,6 +34,4 @@ function byColumn (tabName, sheetName, sheetId, data) {
|
||||
return bp
|
||||
}
|
||||
|
||||
byColumn.resourceName = 'columns'
|
||||
|
||||
export default byColumn
|
||||
export default columns
|
||||
@@ -1,9 +1,9 @@
|
||||
import R from 'ramda'
|
||||
import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
import { defaultBlueprint, defaultResource } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byGroup - generate a Blueprint from a data sheet grouped by a column called 'group'
|
||||
* groups - generate a Blueprint from a data sheet grouped by a column called 'group'
|
||||
* The resource name defaults to 'groups', or a custom resource name can be passed.
|
||||
* Each resource item is an object with values labelled according to column
|
||||
* names. Items are inserted in the data list at idx = id.
|
||||
@@ -13,7 +13,7 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
* @param {type} name="" name of blueprint.
|
||||
* @return {type} Blueprint
|
||||
*/
|
||||
export default function byGroup (
|
||||
export default function groups (
|
||||
tabName,
|
||||
sheetName,
|
||||
sheetId,
|
||||
@@ -31,7 +31,7 @@ export default function byGroup (
|
||||
// Column names define resources
|
||||
const itemLabels = data[0]
|
||||
const fmt = fmtObj(itemLabels)
|
||||
bp.resources[label] = R.clone(defaultRoute)
|
||||
bp.resources[label] = R.clone(defaultResource)
|
||||
bp.resources[label].data = []
|
||||
|
||||
const dataGroups = {}
|
||||
@@ -1,9 +1,9 @@
|
||||
import R from 'ramda'
|
||||
import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
import { defaultBlueprint, defaultResource } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byId - generate a Blueprint from a data sheet by id, which is an integer.
|
||||
* ids - generate a Blueprint from a data sheet by id, which is an integer.
|
||||
* The resource name defaults to 'ids', or a custom resource name can be passed.
|
||||
* Each resource item is an object with values labelled according to column
|
||||
* names. Items are inserted in the data list at idx = id.
|
||||
@@ -13,7 +13,7 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
* @param {type} name="" name of blueprint.
|
||||
* @return {type} Blueprint
|
||||
*/
|
||||
export default function byId (
|
||||
export default function ids (
|
||||
tabName,
|
||||
sheetName,
|
||||
sheetId,
|
||||
@@ -31,7 +31,7 @@ export default function byId (
|
||||
// Column names define resources
|
||||
const itemLabels = data[0]
|
||||
const fmt = fmtObj(itemLabels)
|
||||
bp.resources[label] = R.clone(defaultRoute)
|
||||
bp.resources[label] = R.clone(defaultResource)
|
||||
bp.resources[label].data = []
|
||||
|
||||
data.forEach((row, idx) => {
|
||||
@@ -1,9 +1,9 @@
|
||||
import R from 'ramda'
|
||||
import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
import { defaultBlueprint, defaultResource } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byRow - generate a Blueprint from a data sheet by row. The resource name
|
||||
* rows - generate a Blueprint from a data sheet by row. The resource name
|
||||
* defaults to 'rows', or a custom resource name can be passed. Each resource
|
||||
* item is an object with values labelled according to column names.
|
||||
*
|
||||
@@ -12,7 +12,7 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
* @param {type} name="" name of blueprint.
|
||||
* @return {type} Blueprint
|
||||
*/
|
||||
export default function byRow (
|
||||
export default function rows (
|
||||
tabName,
|
||||
sheetName,
|
||||
sheetId,
|
||||
@@ -30,7 +30,7 @@ export default function byRow (
|
||||
// Column names define resources
|
||||
const itemLabels = data[0]
|
||||
const fmt = fmtObj(itemLabels)
|
||||
bp.resources[label] = R.clone(defaultRoute)
|
||||
bp.resources[label] = R.clone(defaultResource)
|
||||
bp.resources[label].data = []
|
||||
|
||||
data.forEach((row, idx) => {
|
||||
@@ -1,8 +1,8 @@
|
||||
import R from 'ramda'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
import { defaultBlueprint, defaultResource } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byTree - generate a Blueprint from a data sheet grouped by a column called 'group'
|
||||
* tree - generate a Blueprint from a data sheet grouped by a column called 'group'
|
||||
* The resource name defaults to 'groups', or a custom resource name can be passed.
|
||||
* Each resource item is an object with values labelled according to column
|
||||
* names. Items are inserted in the data list at idx = id.
|
||||
@@ -12,7 +12,7 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
* @param {type} name="" name of blueprint.
|
||||
* @return {type} Blueprint
|
||||
*/
|
||||
export default function byTree (
|
||||
export default function tree (
|
||||
tabName,
|
||||
sheetName,
|
||||
sheetId,
|
||||
@@ -28,7 +28,7 @@ export default function byTree (
|
||||
bp.name = tabName
|
||||
|
||||
// Column names define resources
|
||||
bp.resources[label] = R.clone(defaultRoute)
|
||||
bp.resources[label] = R.clone(defaultResource)
|
||||
bp.resources[label].data = {}
|
||||
|
||||
const tree = {
|
||||
Reference in New Issue
Block a user