Skip to content

Instantly share code, notes, and snippets.

View github-francisco-pereira's full-sized avatar
🐊

Chico github-francisco-pereira

🐊
View GitHub Profile
const gql = require('graphql-tag');
const { get, has } = require('lodash');
const { inspect } = require('util');
const logger = require('lib/common/log');
const newrelic = require('newrelic');
const getTransactionName = (({ query }) => {
if (!query) {
return null;
}
const {
GraphQLString,
GraphQLObjectType,
GraphQLBoolean,
GraphQLList,
} = require('graphql');
const ListingErrorResponseType = require('app/types/listing_error');
module.exports = new GraphQLObjectType({
const multer = require('multer');
module.exports = (app) => {
const storage = multer.memoryStorage();
app.use('/', multer({ storage }).single('file'));
};
const {
GraphQLString,
GraphQLObjectType,
async function authenticatedContextRoleResolver(args, context, extension, promiseAction) {
Object.assign(context, { extension });
await authenticatedFlow(context);
const action = `${extension.operation.operation}.${extension.fieldName}`;
if (await userHasAccess(action, context.publisherId, context.user.uuid)) {
const data = await promiseAction(args);
return { data, args, context };
}
throw new CustomError('Unauthorized', 401);
}
@github-francisco-pereira
github-francisco-pereira / Private-pypi-howto
Created September 20, 2017 17:26 — forked from Jaza/Private-pypi-howto
Guide for how to create a (minimal) private PyPI repo, just using Apache with directory autoindex, and pip with an extra index URL.
*