Skip to content

Commit bd33428

Browse files
authored
Merge pull request #320 from topcoder-platform/feature/filter_disabled_templates_from_list_endpoint
stopping disabled templates to be returned in response of list endpoints
2 parents 7deeec1 + 70f6eca commit bd33428

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

src/routes/metadata/list.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ function getUsedModel() {
2727
priceConfig: { },
2828
};
2929
const query = {
30+
where: {
31+
deletedAt: { $eq: null },
32+
disabled: false,
33+
},
3034
attributes: { exclude: ['deletedAt', 'deletedBy'] },
3135
raw: true,
3236
};

src/routes/productTemplates/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = [
1414
if (!util.isValidFilter(filters, ['productKey'])) {
1515
return util.handleError('Invalid filters', null, req, next);
1616
}
17-
const where = { deletedAt: { $eq: null } };
17+
const where = { deletedAt: { $eq: null }, disabled: false };
1818
if (filters.productKey) {
1919
where.productKey = { $eq: filters.productKey };
2020
}

src/routes/productTemplates/list.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('LIST product templates', () => {
5151
},
5252
alias2: [1, 2, 3],
5353
},
54-
disabled: true,
54+
disabled: false,
5555
hidden: true,
5656
isAddOn: true,
5757
template: {

src/routes/projectTemplates/list.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = [
1212
(req, res, next) => models.ProjectTemplate.findAll({
1313
where: {
1414
deletedAt: { $eq: null },
15+
disabled: false,
1516
},
1617
attributes: { exclude: ['deletedAt', 'deletedBy'] },
1718
raw: true,

src/routes/projectTemplates/list.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('LIST project templates', () => {
2020
question: 'question 1',
2121
info: 'info 1',
2222
aliases: ['key-1', 'key_1'],
23-
disabled: true,
23+
disabled: false,
2424
hidden: true,
2525
scope: {
2626
scope1: {

0 commit comments

Comments
 (0)