I hereby claim:
- I am projectcheshire on github.
- I am mynja (https://keybase.io/mynja) on keybase.
- I have a public key ASCiHWVkAPZM8cU-r-90lS23EtXTeId58qD9oYuUM7yOJAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Events
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| import os | |
| import importlib | |
| from inspect import getmembers, isclass | |
| from graphene import ObjectType | |
| from logzero import logger | |
| def schema_operations_builder(operationName, operationModule, operationBase, clsName): | |
| op_base_classes = build_base_classes(operationName, operationModule, operationBase, clsName) |
| import json | |
| import geojson | |
| from shapely.geometry import shape | |
| o = { | |
| "coordinates": [[[23.314208, 37.768469], [24.039306, 37.768469], [24.039306, 38.214372], [23.314208, 38.214372], [23.314208, 37.768469]]], | |
| "type": "Polygon" | |
| } | |
| s = json.dumps(o) |
| import { AlreadyAuthenticatedError, NotAuthenticatedError, NotAuthorizedError } from '../errors/functional'; | |
| import createResolver from '../lib/createResolver'; | |
| export const baseResolver = createResolver(); | |
| export const isAuthenticatedResolver = baseResolver.createResolver( | |
| (root, args, context) => { | |
| if (!context.user || !context.user.id) throw new NotAuthenticatedError(); | |
| } |
| type Location implements Resource { | |
| # Primary key | |
| id: ID! | |
| # Google's name for the Location | |
| googleName: String! | |
| # Google's ID for the Location | |
| googleId: ID! | |
| # Google's Place ID for the Location | |
| googlePlaceId: ID! | |
| # Google's Timezone ID for the Location |
| 1. Build GraphQL server using `express-graphql` package. | |
| 2. Configure `schema.js` file. | |
| 3. Query for data. |
| var getNode = function(id, type) { | |
| var deferred = q.defer(); | |
| var query = [ | |
| 'START entity=node:nodes(type = {type})', | |
| 'MATCH entity', | |
| 'WHERE entity.id = {id}', | |
| 'RETURN entity;' | |
| ].join('\n'); | |
| var params = { |
| var session = require('./session') | |
| class User { | |
| /** | |
| Creates a User Node in neo4j | |
| * @param {string} uuid (required) - refference id | |
| * @param {string} parentId (required only if reffered by another user) - uuid of parentId | |
| * @param {int/float} sRate (optional) - special rate between user and | |
| * returns Promise | |
| */ | |
| static create(data,parentId=null,sRate = null){ |