7 Commits

Author SHA1 Message Date
efarooqui
f093253d87 Removing unecessary console error 2021-06-09 20:01:20 -07:00
efarooqui
011c667805 Unpacking params for request from media 2021-06-09 01:14:02 -07:00
efarooqui
66d7d42497 Adding media fetch endpoint; working query with hardcoded incident 2021-06-08 18:46:33 -07:00
Ebrahem Farooqui
71a8687003 Merge pull request #74 from forensic-architecture/feature/add-shapes-filter-panel
Adding export_shapes endpoint
2021-05-24 22:47:57 -07:00
Ebrahem Farooqui
63d168a964 changing push branch to dev 2021-05-24 22:18:28 -07:00
Ebrahem Farooqui
4d310270d5 changing push branch temp 2021-05-24 22:17:10 -07:00
efarooqui
a6cc9491c6 Adding export_shapes endpoint 2021-05-24 16:10:34 -07:00
4 changed files with 22 additions and 5772 deletions

View File

@@ -1,5 +1,7 @@
import { version } from '../../package.json'
import fetch from 'node-fetch'
import { Router } from 'express'
import { getParameterByName } from '../lib/util'
import copy from '../copy/en'
export default ({ config, controller }) => {
@@ -22,6 +24,21 @@ export default ({ config, controller }) => {
})
})
api.get('/media/:code', (req, res) => {
const { code } = req.params
fetch(`${process.env.MEDIA_API_ENDPOINT}/${code}`, {
method: 'get',
headers: {
'Authorization': 'Basic ' + new Buffer(process.env.MEDIA_AUTH_USER + ":" + process.env.MEDIA_AUTH_PWORD).toString("base64")
}
})
.then(response => response.json())
.then(data => res.send(data.data))
.catch(err => {
res.status(err.status || 404).send({ error: err.message })
});
})
api.get('/update', (req, res) => {
controller
.update()

View File

@@ -7,6 +7,7 @@ function prefixedTabs (prefix, cfg) {
[`${prf('events')}export_events`]: BP.deeprows,
[`${prf('associations')}export_associations`]: BP.deeprows,
[`${prf('sources')}export_sources`]: BP.deepids,
[`${prf('shapes')}export_shapes`]: BP.deeprows,
[`${prf('sites')}export_sites`]: BP.rows
}
}

View File

@@ -2,7 +2,7 @@ import path from 'path'
import fs from 'fs'
import R from 'ramda'
const defaultBlueprint = {
export const defaultBlueprint = {
name: null,
sheet: {
name: null,
@@ -11,11 +11,11 @@ const defaultBlueprint = {
resources: {}
}
const defaultResource = {
export const defaultResource = {
data: []
}
function buildDesaturated (sheetId, sheetName, tab, resources) {
export function buildDesaturated (sheetId, sheetName, tab, resources) {
const bp = R.clone(defaultBlueprint)
bp.sheet.name = sheetName
bp.sheet.id = sheetId
@@ -50,25 +50,10 @@ fs.readdirSync(normalizedPath).forEach(file => {
allBps[bpName] = buildBlueprinter(bpName, datafier)
})
function deeprowsWithSchema (datafierName, schema) {
const datafier = data => {
const transformedData = allBps.deeprows('', '', '', data).resources.deeprows.data
return transformedData.map(row => {
Object.keys(schema).forEach(key => {
row[key] = schema[key](row[key])
})
return row
})
}
return buildBlueprinter(`deeprows_${datafierName}`, datafier)
}
// NB: revert to ES5 'module.exports' required to make blueprinters from
// each file in blueprinters folder available for granular import from here.
module.exports = Object.assign({
defaultBlueprint,
defaultResource,
buildDesaturated,
deeprowsWithSchema
buildDesaturated
}, allBps)

5753
yarn.lock

File diff suppressed because it is too large Load Diff