Skip to content

Organization config final fixes #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions migrations/20190129_organization_config.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
--
CREATE TABLE org_config (
id bigint NOT NULL,
orgId character varying(45) NOT NULL,
configName character varying(45) NOT NULL,
configValue character varying(512),
"orgId" character varying(45) NOT NULL,
"configName" character varying(45) NOT NULL,
"configValue" character varying(512),
"deletedAt" timestamp with time zone,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/routes/orgConfig/list.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
/**
* API to list organization config
*/
import validate from 'express-validation';
import Joi from 'joi';
import { middleware as tcMiddleware } from 'tc-core-library-js';
import models from '../../models';
import util from '../../util';

const permissions = tcMiddleware.permissions;

const schema = {
query: {
filter: Joi.string().required(),
},
};

module.exports = [
validate(schema),
permissions('orgConfig.view'),
(req, res, next) => {
// handle filters
const filters = util.parseQueryFilter(req.query.filter);
// Throw error if orgId is not present in filter
if (!filters.orgId) {
return next(util.buildApiError('Missing filter orgId', 422));
}
if (!util.isValidFilter(filters, ['orgId', 'configName'])) {
return util.handleError('Invalid filters', null, req, next);
}
Expand Down
Loading