13 Commits

Author SHA1 Message Date
Lachlan Kermode
db2672b630 export as deeprowsWithSchema 2021-05-17 16:18:07 +12:00
Lachlan Kermode
69e54a6027 Update yarn lock 2021-05-17 16:01:24 +12:00
Lachlan Kermode
6c090549c7 Add blueprinterWithSchema exporter 2021-05-17 16:01:18 +12: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
Ebrahem Farooqui
679407f421 adding env vars for test and lint 2021-03-01 16:05:16 -08:00
Ebrahem Farooqui
3eebf811fb Incorrect syntax for unpacking head ref 2021-02-22 09:50:46 -08:00
Ebrahem Farooqui
be03a3983a Adding branch to checkout
Adding the correct branch to checkout with for workflow
2021-02-22 09:47:05 -08:00
9 changed files with 5787 additions and 11 deletions

View File

@@ -10,11 +10,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- run: npm install
- run: npm test
env:
CI: true
- run: npm run lint
env:
CI: true

View File

@@ -30,10 +30,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

@@ -1 +0,0 @@
CONFIG=../configs/timemap/grenfell/datasheet.config.js

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

@@ -2,7 +2,7 @@ import path from 'path'
import fs from 'fs'
import R from 'ramda'
export const defaultBlueprint = {
const defaultBlueprint = {
name: null,
sheet: {
name: null,
@@ -11,11 +11,11 @@ export const defaultBlueprint = {
resources: {}
}
export const defaultResource = {
const defaultResource = {
data: []
}
export function buildDesaturated (sheetId, sheetName, tab, resources) {
function buildDesaturated (sheetId, sheetName, tab, resources) {
const bp = R.clone(defaultBlueprint)
bp.sheet.name = sheetName
bp.sheet.id = sheetId
@@ -50,10 +50,25 @@ 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
buildDesaturated,
deeprowsWithSchema
}, allBps)

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: {

5753
yarn.lock Normal file

File diff suppressed because it is too large Load Diff