Skip to content

Commit e0a0dbf

Browse files
committed
Minor fixes
1 parent afb10cf commit e0a0dbf

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

graphql-api-generator/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def run(schema: GraphQLSchema, config: dict):
138138
raise UnsupportedOperation('{0} is currently not supported'.format('delete_edge_objects'))
139139

140140
# remove field arguments for edges (should not be in the API schema)
141-
#schema = remove_field_arguments_for_types(schema)
141+
schema = remove_field_arguments_for_types(schema)
142142

143143
return schema
144144

graphql-server/drivers/arangodb/driver.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let disableEdgeValidation;
1010
module.exports = {
1111
init: async function(schema){
1212
let db_name = process.env.db ? process.env.db : 'dev-db';
13-
let url = process.env.URL ? process.env.URL: 'http://localhost:8529';
13+
let url = process.env.URL ? process.env.URL : 'http://localhost:8529';
1414
let drop = process.env.DROP === 'true';
1515
disableEdgeValidation = process.env.DISABLE_EDGE_VALIDATION === 'true';
1616
db = new arangojs.Database({ url: url });
@@ -44,10 +44,10 @@ module.exports = {
4444
getByKey: function(key, info){
4545
return getByKey(key, info);
4646
},
47-
create: function(isRoot, context, data, returnType, info){
47+
create: function(isRoot, context, data, returnType, info) {
4848
return create(isRoot, context, data, returnType, info);
4949
},
50-
createEdge: async function(isRoot, ctxt, source, sourceType, sourceField, target, targetType, annotations, info){
50+
createEdge: async function(isRoot, ctxt, source, sourceType, sourceField, target, targetType, annotations, info) {
5151
return await createEdge(isRoot, ctxt, source, sourceType, sourceField, target, targetType, annotations, info);
5252
},
5353
update: async function(isRoot, ctxt, id, data, returnType, info){
@@ -59,19 +59,19 @@ module.exports = {
5959
getList: async function(args, info){
6060
return await getList(args, info);
6161
},
62-
getTotalCount: async function(parent, args, info){
62+
getTotalCount: async function (parent, args, info) {
6363
return await getTotalCount(parent, args, info);
6464
},
65-
isEndOfList: async function(parent, args, info){
65+
isEndOfList: async function (parent, args, info) {
6666
return await isEndOfList(parent, args, info);
6767
},
68-
addPossibleTypes: function(query, schema, type_name){
68+
addPossibleTypes: function (query, schema, type_name) {
6969
return addPossibleTypes(query, schema, type_name);
7070
},
71-
addPossibleEdgeTypes: function(query, schema, type_name, field_name){
71+
addPossibleEdgeTypes: function (query, schema, type_name, field_name) {
7272
return addPossibleEdgeTypes(query, schema, type_name, field_name);
7373
},
74-
getEdgeCollectionName: function(type, field){
74+
getEdgeCollectionName: function (type, field) {
7575
return getEdgeCollectionName(type, field);
7676
},
7777
hello: () => hello() // TODO: Remove after testing
@@ -81,7 +81,7 @@ async function hello(){
8181
return "This is the arangodb.tools saying hello!"
8282
}
8383

84-
async function createAndUseDatabase(db, db_name) {
84+
async function createAndUseDatabase(db, db_name){
8585
await db.createDatabase(db_name).then(
8686
() => { console.info(`Database '${db_name}' created`); },
8787
err => { console.warn(`Database '${db_name}' not created:`, err.response.body.errorMessage); }
@@ -251,13 +251,13 @@ async function getEdge(parent, args, info){
251251

252252
// Create query
253253
let query = [aql`FOR x IN`];
254-
if (info.fieldName.startsWith('_')) {
254+
if(info.fieldName.startsWith('_')) {
255255
// If the type that is the origin of the edge is an interface, then we need to check all the edge collections
256256
// corresponding to its implementing types. Note: This is only necessary when traversing some edges that are
257257
// defined in in the API schema for interfaces. The parent type will never be an interface type at this stage.
258258
if(graphql.isInterfaceType(return_type)){
259259
let possible_types = info.schema.getPossibleTypes(return_type);
260-
if (possible_types.length > 1) query.push(aql`UNION(`);
260+
if(possible_types.length > 1) query.push(aql`UNION(`);
261261
for(let i in possible_types) {
262262
if(i != 0) query.push(aql`,`);
263263
let collection = db.collection(getEdgeCollectionName(possible_types[i].name, field_name));
@@ -303,7 +303,6 @@ async function create(isRoot, ctxt, data, returnType, info){
303303

304304
// is root op and mutatation is already queued
305305
if(isRoot && ctxt.trans.queue[info.path.key]){
306-
307306
if(ctxt.trans.open) await executeTransaction(ctxt);
308307
if(ctxt.trans.error){
309308
if(ctxt.trans.errorReported) return null;
@@ -386,7 +385,7 @@ async function create(isRoot, ctxt, data, returnType, info){
386385
addfinalDirectiveChecksForType(ctxt, returnType, aql`${asAQLVar(resVar)}._id`, info.schema);
387386

388387
// overwrite the current action
389-
if(isRoot){
388+
if(isRoot) {
390389
ctxt.trans.code.push(`result['${info.path.key}'] = ${resVar};`); // add root result
391390
ctxt.trans.queue[info.path.key] = true; // indicate that this mutation op has been added to the transaction
392391
getVar(ctxt); // increment varCounter

0 commit comments

Comments
 (0)