15 Commits

Author SHA1 Message Date
efarooqui
fdee3fa581 Minor changes to media endpoint 2021-06-20 23:11:38 -07:00
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
efarooqui
0ee207dc75 Linting fixes 2021-04-30 19:34:29 -07:00
efarooqui
7e97c5c227 Minor comment to trigger job 2021-04-30 19:31:16 -07:00
efarooqui
978d572660 Minor comment to trigger job 2021-04-14 19:58:55 -07:00
efarooqui
8bd5f38ac4 Error logging for gsheet fetch 2021-04-14 18:07:48 -07:00
efarooqui
6ab37ccb70 Extraneous comment added to trigger job 2021-04-14 16:35:27 -07:00
efarooqui
4976bfd985 Merge branch 'develop' of https://www.github.com/forensic-architecture/datasheet-server into develop 2021-04-14 16:12:46 -07:00
efarooqui
d713a15879 Adding comment to trigger job 2021-04-14 16:11:40 -07:00
6 changed files with 27 additions and 6 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))
.catch(err => {
res.status(err.status || 404).send({ error: err.message })
});
})
api.get('/update', (req, res) => {
controller
.update()
@@ -30,10 +47,10 @@ export default ({ config, controller }) => {
success: msg
})
)
.catch(err =>
.catch(err => {
res.status(404)
.send({ error: err.message, err })
)
})
})
api.get('/:sheet/:tab/:resource/:frag', (req, res) => {

View File

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

View File

@@ -1,7 +1,7 @@
import copy from '../copy/en'
/**
* Controller
* Controller class
*
*/
class Controller {

View File

@@ -217,7 +217,10 @@ class GsheetFetcher extends Fetcher {
})
.then(this._buildBlueprintsAsync())
.then(() => true)
.catch(() => false)
.catch((err) => {
console.log(`Error fetching gsheets: ${err.message} `)
return false
})
}
}

View File

@@ -19,7 +19,6 @@ class StoreJson {
save (url, data) {
const parts = url.split('/')
return fs.writeFile(
`${STORAGE_DIRNAME}/${parts[0]}__${parts[1]}__${parts[2]}.json`,
JSON.stringify(data)

View File

@@ -12,6 +12,8 @@ const egInput1 = [
[4, 5, 6]
]
// Test default blueprint exports
// Smoke tests
test('defaultBlueprint exports', t => {
const expected = {
sheet: {