mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-11 12:58:32 +03:00
rename source to sheet
This commit is contained in:
@@ -2,19 +2,19 @@ import R from 'ramda'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byColumn - generate a Blueprint from a data source by column. Each column
|
||||
* name is a resource, and all values in that column are the resource items.
|
||||
* byColumn - generate a Blueprint from a data sheet by column. Each column
|
||||
* name is a resheet, and all values in that column are the resheet items.
|
||||
*
|
||||
* @param {type} data - list of lists representing sheet data.
|
||||
* @return {type} Blueprint
|
||||
* generated.
|
||||
*/
|
||||
export default function byColumn (tabName, sourceName, sourceId, data) {
|
||||
export default function byColumn (tabName, sheetName, sheetId, data) {
|
||||
// Define Blueprint props
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.source = {
|
||||
name: sourceName,
|
||||
id: sourceId
|
||||
bp.sheet = {
|
||||
name: sheetName,
|
||||
id: sheetId
|
||||
}
|
||||
bp.name = tabName
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byGroup - generate a Blueprint from a data source grouped by a column called 'group'
|
||||
* byGroup - 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.
|
||||
@@ -15,16 +15,16 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
*/
|
||||
export default function byGroup (
|
||||
tabName,
|
||||
sourceName,
|
||||
sourceId,
|
||||
sheetName,
|
||||
sheetId,
|
||||
data,
|
||||
label = 'groups'
|
||||
) {
|
||||
// Define Blueprint
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.source = {
|
||||
name: sourceName,
|
||||
id: sourceId
|
||||
bp.sheet = {
|
||||
name: sheetName,
|
||||
id: sheetId
|
||||
}
|
||||
bp.name = tabName
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byId - generate a Blueprint from a data source by id, which is an integer.
|
||||
* byId - 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.
|
||||
@@ -15,16 +15,16 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
*/
|
||||
export default function byId (
|
||||
tabName,
|
||||
sourceName,
|
||||
sourceId,
|
||||
sheetName,
|
||||
sheetId,
|
||||
data,
|
||||
label = 'ids'
|
||||
) {
|
||||
// Define Blueprint
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.source = {
|
||||
name: sourceName,
|
||||
id: sourceId
|
||||
bp.sheet = {
|
||||
name: sheetName,
|
||||
id: sheetId
|
||||
}
|
||||
bp.name = tabName
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { fmtObj } from '../lib/util'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byRow - generate a Blueprint from a data source by row. The resource name
|
||||
* byRow - 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.
|
||||
*
|
||||
@@ -14,16 +14,16 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
*/
|
||||
export default function byRow (
|
||||
tabName,
|
||||
sourceName,
|
||||
sourceId,
|
||||
sheetName,
|
||||
sheetId,
|
||||
data,
|
||||
label = 'rows'
|
||||
) {
|
||||
// Define Blueprint
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.source = {
|
||||
name: sourceName,
|
||||
id: sourceId
|
||||
bp.sheet = {
|
||||
name: sheetName,
|
||||
id: sheetId
|
||||
}
|
||||
bp.name = tabName
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import R from 'ramda'
|
||||
import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
|
||||
/**
|
||||
* byTree - generate a Blueprint from a data source grouped by a column called 'group'
|
||||
* byTree - 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.
|
||||
@@ -14,16 +14,16 @@ import { defaultBlueprint, defaultRoute } from '../lib/blueprinters'
|
||||
*/
|
||||
export default function byTree (
|
||||
tabName,
|
||||
sourceName,
|
||||
sourceId,
|
||||
sheetName,
|
||||
sheetId,
|
||||
data,
|
||||
label = 'tree'
|
||||
) {
|
||||
// Define Blueprint
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.source = {
|
||||
name: sourceName,
|
||||
id: sourceId
|
||||
bp.sheet = {
|
||||
name: sheetName,
|
||||
id: sheetId
|
||||
}
|
||||
bp.name = tabName
|
||||
|
||||
|
||||
Reference in New Issue
Block a user