Release candidate of namespace CRUD
This commit is contained in:
parent
5b82d3b540
commit
8e54879539
11 changed files with 354 additions and 111 deletions
|
@ -59,7 +59,16 @@ async function updateWithConsistencyCheck(ns) {
|
|||
}
|
||||
|
||||
async function remove(nsId) {
|
||||
await knex('namespaces').where('id', nsId).del();
|
||||
enforce(nsId !== 1, 'Cannot delete the root namespace.');
|
||||
|
||||
await knex.transaction(async tx => {
|
||||
const childNs = await tx('namespaces').where('parent', nsId).first();
|
||||
if (childNs) {
|
||||
throw new interoperableErrors.ChildDetectedError();
|
||||
}
|
||||
|
||||
await tx('namespaces').where('id', nsId).del();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue