Skip to content

Commit

Permalink
fix: changelist serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Mar 1, 2022
1 parent cc604b1 commit cd2e5b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ app.use(function (req, res, next) {

// Add readonly header if set in .env file
app.use(function (req, res, next) {
res.setHeader('Access-Control-Expose-Headers', 'cw-read-only');
if (process.env.READ_ONLY) {
res.setHeader('cw-read-only', process.env.READ_ONLY);
} else {
res.setHeader('cw-read-only', false);
}

next();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xls.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export const transformFullXslsToChangeList = async (
`${key}|${r[primaryKeyIndex]}`,
);

if (action === 'update') {
if (['update', 'insert'].includes(action)) {
let isUpdate = await ModelKeys[key].findByPk(
r[primaryKeyIndex],
);
Expand Down
1 change: 1 addition & 0 deletions tests/test-fixtures/project-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const getProject = async (warehouseProjectId) => {
const result = await supertest(app)
.get('/v1/projects')
.query({ warehouseProjectId });

expect(result.body).to.be.an('object');
expect(result.body.warehouseProjectId).to.equal(warehouseProjectId);
expect(result.statusCode).to.equal(200);
Expand Down

0 comments on commit cd2e5b6

Please sign in to comment.