-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change order of fields and field/title names on Cost Allocation and O…
…ther Funding + Budget and FFP pages. #2322 (#2474) * use node v10 via node version manager* prefer doc format output from tap * add validateApd function, validate development seed data * validate seed data, fix bad seed data * refactor apd.json schema * remove vcap junk * Update CHANGELOG.md * add knex-console script, add {migrate,seed}-dev scripts * update audit ci * render costAllocationNarrative keys that are years
- Loading branch information
Showing
62 changed files
with
2,772 additions
and
2,092 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ npm-debug.log* | |
pgdata | ||
__files | ||
api/test-data/files | ||
notes.md | ||
schema.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
const knex = require('knex'); | ||
const config = require('../knexfile'); | ||
|
||
const db = process.env.NODE_ENV ? knex(config[process.env.NODE_ENV]) : () => {}; | ||
const { NODE_ENV } = process.env; | ||
if (!NODE_ENV) { | ||
let msg = "❌ NODE_ENV is not set, unable to determine knex configuration\n"; | ||
msg += "Please set NODE_ENV to 'development', 'test', or 'production'\n"; | ||
msg += "Terminating..."; | ||
console.error(msg); /* eslint-disable-line no-console */ | ||
process.exit(1); | ||
} | ||
|
||
module.exports = db; | ||
module.exports = knex(config[NODE_ENV]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// https://medium.com/@sobinsunny/orm-console-with-repl-961ee264ed93 | ||
|
||
// usage: | ||
// $ npm run knex-console | ||
// knex> const rows = await knex('apds') | ||
// knex> rows[0].document.activities | ||
// knex> .exit | ||
|
||
require('dotenv').config(); | ||
const repl = require('repl'); | ||
const knex = require('./db/knex') | ||
|
||
const r = repl.start('knex> '); | ||
const run = async () => { | ||
r.context.knex = await knex; | ||
}; | ||
run(); |
24 changes: 24 additions & 0 deletions
24
api/migrations/20200918103000_add-ffy-to-other-funding-desc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-disable no-param-reassign */ | ||
exports.up = async knex => { | ||
const apdRecords = await knex('apds').select('document', 'id', 'years'); | ||
|
||
apdRecords.forEach(({ document, id }) => { | ||
const years = document.years; | ||
|
||
document.activities.forEach(activity => { | ||
const otherSources = activity.costAllocationNarrative.otherSources || "" | ||
years.forEach(year => { | ||
activity.costAllocationNarrative[year] = { | ||
otherSources | ||
} | ||
}); | ||
delete activity.costAllocationNarrative.otherSources; | ||
}); | ||
|
||
knex('apds') | ||
.where('id', id) | ||
.update({ document }); | ||
}); | ||
}; | ||
|
||
exports.down = async () => {}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.