Namespace selection for users, reports and report-templates
This commit is contained in:
parent
4822a50d0b
commit
e7bdfb7745
16 changed files with 210 additions and 62 deletions
16
lib/namespace-helpers.js
Normal file
16
lib/namespace-helpers.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const knex = require('./knex');
|
||||
const { enforce } = require('./helpers');
|
||||
const interoperableErrors = require('../shared/interoperable-errors');
|
||||
|
||||
async function validateEntity(tx, entity) {
|
||||
enforce(entity.namespace, 'Entity namespace not set');
|
||||
if (!await tx('namespaces').where('id', entity.namespace).first()) {
|
||||
throw new interoperableErrors.DependencyNotFoundError();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
validateEntity
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue