Skip to content

Commit be21607

Browse files
authored
Merge branch 'develop' into feature/DEVSU-2815-make-create-report-access-project-specific
2 parents 767803f + c16035a commit be21607

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

app/models/reports/report.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ module.exports = (sequelize, Sq) => {
168168
type: Sq.STRING,
169169
defaultValue: null,
170170
},
171+
dataType: {
172+
name: 'dataType',
173+
field: 'data_type',
174+
type: Sq.STRING,
175+
defaultValue: null,
176+
},
171177
uploadContents: {
172178
name: 'uploadContents',
173179
field: 'upload_contents',

app/routes/report/report.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,14 @@ router.route('/')
398398
req.body.sampleInfo = cleanSampleInfo;
399399
}
400400

401+
if (req.body.seqQC) {
402+
req.body.dataType = req.body.seqQC.filter(
403+
(item) => {return item.Sample?.startsWith('Tumour');},
404+
).map(
405+
(item) => {return item.Sample.replace(/^Tumour\s+/i, '');},
406+
).join(', ');
407+
}
408+
401409
try {
402410
// eslint-disable-next-line camelcase
403411
if (ignore_extra_fields) {

app/routes/report/reportAsync.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ router.route('/')
5959
req.body.sampleInfo = cleanSampleInfo;
6060
}
6161

62+
if (req.body.seqQC) {
63+
req.body.dataType = req.body.seqQC.filter(
64+
(item) => {return item.Sample?.startsWith('Tumour');},
65+
).map(
66+
(item) => {return item.Sample.replace(/^Tumour\s+/i, '');},
67+
).join(', ');
68+
}
69+
6270
try {
6371
// eslint-disable-next-line camelcase
6472
if (ignore_extra_fields) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const TABLE = 'reports';
2+
3+
module.exports = {
4+
up: async (queryInterface, Sq) => {
5+
return queryInterface.sequelize.transaction(async (transaction) => {
6+
await queryInterface.addColumn(
7+
TABLE,
8+
'data_type',
9+
{
10+
type: Sq.STRING,
11+
defaultValue: null,
12+
},
13+
{transaction},
14+
);
15+
});
16+
},
17+
18+
down: async () => {
19+
throw new Error('Not Implemented!');
20+
},
21+
};

0 commit comments

Comments
 (0)