Skip to content

Commit b93f2c2

Browse files
committed
Merge branch '1857-DAPS-python-client-schema-support' of github.com:ORNL/DataFed into 1857-DAPS-python-client-schema-support
2 parents 3d190f1 + 8ad99ca commit b93f2c2

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

core/database/foxx/api/schema_router.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ function parseSchemaId(schId) {
6666
const ver = Number(verStr);
6767

6868
if (verStr.length === 0) {
69-
throw [error.ERR_INVALID_PARAM, "Schema ID has trailing colon with no version: '" + schId + "'"];
69+
throw [
70+
error.ERR_INVALID_PARAM,
71+
"Schema ID has trailing colon with no version: '" + schId + "'",
72+
];
7073
}
7174

7275
if (!Number.isInteger(ver)) {
73-
throw [error.ERR_INVALID_PARAM, "Schema ID version suffix is not a valid integer: '" + verStr + "'"];
76+
throw [
77+
error.ERR_INVALID_PARAM,
78+
"Schema ID version suffix is not a valid integer: '" + verStr + "'",
79+
];
7480
}
7581

7682
return { id: schId.substr(0, idx), ver: ver };
@@ -172,9 +178,12 @@ router
172178
}
173179

174180
const parsed = parseSchemaId(req.body.id);
175-
181+
176182
if (parsed.ver !== null && parsed.ver !== 0) {
177-
throw [error.ERR_INVALID_PARAM, "Schema ID version must be 0 for creation, got: " + parsed.ver];
183+
throw [
184+
error.ERR_INVALID_PARAM,
185+
"Schema ID version must be 0 for creation, got: " + parsed.ver,
186+
];
178187
}
179188

180189
g_lib.procInputParam(req.body, "_sch_id", false, obj);
@@ -596,7 +605,6 @@ router
596605
},
597606
waitForSync: true,
598607
action: function () {
599-
600608
const client = g_lib.getUserFromClientID(req.queryParams.client);
601609
const parsed = parseSchemaId(req.queryParams.id);
602610
if (parsed.ver === null) {
@@ -605,9 +613,13 @@ router
605613
sch_old = g_db.sch.firstExample({ id: parsed.id, ver: parsed.ver });
606614

607615
if (!sch_old)
608-
throw [error.ERR_NOT_FOUND, "Schema '" + req.queryParams.id + "' not found."];
616+
throw [
617+
error.ERR_NOT_FOUND,
618+
"Schema '" + req.queryParams.id + "' not found.",
619+
];
609620

610-
if (sch_old.own_id != client._id && !client.is_admin) throw error.ERR_PERM_DENIED;
621+
if (sch_old.own_id != client._id && !client.is_admin)
622+
throw error.ERR_PERM_DENIED;
611623

612624
// Cannot delete schemas that are in use
613625
if (sch_old.cnt) {
@@ -638,7 +650,10 @@ router
638650
_to: sch_old._id,
639651
})
640652
) {
641-
throw [error.ERR_PERM_DENIED, "Cannot delete intermediate schema revisions."];
653+
throw [
654+
error.ERR_PERM_DENIED,
655+
"Cannot delete intermediate schema revisions.",
656+
];
642657
}
643658

644659
g_graph.sch.remove(sch_old._id);

0 commit comments

Comments
 (0)