mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-08 03:18:33 +03:00
strip down blueprint structure to what is necessary
This commit is contained in:
@@ -68,8 +68,11 @@ class Fetcher {
|
||||
const parts = url.split('/')
|
||||
acc.push([ parts[1], parts[2] ])
|
||||
return acc
|
||||
} else {
|
||||
return acc
|
||||
}
|
||||
}, [])
|
||||
|
||||
return allParts
|
||||
.map(parts => buildDesaturated(
|
||||
this.sheetId,
|
||||
|
||||
@@ -4,23 +4,23 @@ import R from 'ramda'
|
||||
|
||||
export const defaultBlueprint = {
|
||||
name: null,
|
||||
id: null,
|
||||
dialects: ['rest'], // supported dialects, can (eventually) be multiple
|
||||
sheet: {
|
||||
name: null,
|
||||
id: null
|
||||
},
|
||||
resources: {}
|
||||
}
|
||||
|
||||
export const defaultResource = {
|
||||
options: {
|
||||
fragment: true
|
||||
},
|
||||
data: []
|
||||
}
|
||||
|
||||
export function buildDesaturated (sheetId, sheetName, tab, resource) {
|
||||
const bp = R.clone(defaultBlueprint)
|
||||
bp.name = sheetName
|
||||
bp.id = sheetId
|
||||
bp.resources[tab] = resource
|
||||
bp.sheet.name = sheetName
|
||||
bp.sheet.id = sheetId
|
||||
bp.name = tab
|
||||
bp.resources[resource] = null
|
||||
return bp
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,11 @@ const egInput1 = [
|
||||
|
||||
test('defaultBlueprint exports', t => {
|
||||
const expected = {
|
||||
sheet: {
|
||||
name: null,
|
||||
id: null
|
||||
},
|
||||
name: null,
|
||||
id: null,
|
||||
dialects: ['rest'],
|
||||
resources: {}
|
||||
}
|
||||
t.deepEqual(expected, defaultBlueprint)
|
||||
|
||||
Reference in New Issue
Block a user