How to use @croquiscom/crary-graphql - 4 common examples

To help you get started, we’ve selected a few @croquiscom/crary-graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github croquiscom / cormo / packages / graphql / src / schema.ts View on Github external
} else if (field.endsWith('_lte')) {
                query.where({ [field.replace(/_lte$/, '')]: { $lte: value } });
              } else if (field.endsWith('_lt')) {
                query.where({ [field.replace(/_lt$/, '')]: { $lt: value } });
              } else if (field === 'order') {
                query.order(value);
              } else if (field === 'limit_count') {
                query.limit(value);
              } else if (field === 'skip_count') {
                query.skip(value);
              } else {
                query.where({ [field]: value });
              }
            }
          }
          return await query.select(getFieldList(info) as any);
        },
        type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(single_type))),
github croquiscom / cormo / packages / graphql / lib / schema.js View on Github external
graphql_type = graphql_1.GraphQLFloat;
    }
    else if (property.type_class === cormo.types.Integer) {
        graphql_type = graphql_1.GraphQLInt;
    }
    else if (property.type_class === cormo.types.String) {
        graphql_type = graphql_1.GraphQLString;
    }
    else if (property.type_class === cormo.types.Text) {
        graphql_type = graphql_1.GraphQLString;
    }
    else if (property.type_class === cormo.types.Date) {
        graphql_type = crary_graphql_1.CrTimestamp;
    }
    else if (property.type_class === cormo.types.Object) {
        graphql_type = crary_graphql_1.CrJson;
    }
    if (graphql_type && property.required) {
        return new graphql_1.GraphQLNonNull(graphql_type);
    }
    return graphql_type;
}
function createSingleType(model_class, options) {
github croquiscom / cormo / packages / graphql / lib / schema.js View on Github external
return new graphql_1.GraphQLNonNull(graphql_1.GraphQLID);
    }
    else if (property.type_class === cormo.types.Number) {
        graphql_type = graphql_1.GraphQLFloat;
    }
    else if (property.type_class === cormo.types.Integer) {
        graphql_type = graphql_1.GraphQLInt;
    }
    else if (property.type_class === cormo.types.String) {
        graphql_type = graphql_1.GraphQLString;
    }
    else if (property.type_class === cormo.types.Text) {
        graphql_type = graphql_1.GraphQLString;
    }
    else if (property.type_class === cormo.types.Date) {
        graphql_type = crary_graphql_1.CrTimestamp;
    }
    else if (property.type_class === cormo.types.Object) {
        graphql_type = crary_graphql_1.CrJson;
    }
    if (graphql_type && property.required) {
        return new graphql_1.GraphQLNonNull(graphql_type);
    }
    return graphql_type;
}
function createSingleType(model_class, options) {
github croquiscom / cormo / packages / graphql / lib / schema.js View on Github external
async resolve(source, args, context, info) {
                        const query = model_class.query().one();
                        let has_query = false;
                        for (const [field, value] of Object.entries(args)) {
                            if (value) {
                                has_query = true;
                                query.where({ [field]: value });
                            }
                        }
                        if (!has_query) {
                            return null;
                        }
                        return await query.select(crary_graphql_1.getFieldList(info));
                    },
                    type: single_type,

@croquiscom/crary-graphql

Croquis's library - graphql extension

MIT
Latest version published 17 days ago

Package Health Score

63 / 100
Full package analysis

Similar packages