Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dob: String,
createdAt: Date,
updatedAt: Date,
});
import { composeType, composeField, composeResolve, composeInterface, composeStorage } from 'graphql-compose';
import { description, only, remove, restrict, add } from 'graphql-compose/type';
import { composeTypeFromMongoose } from 'graphql-compose-mongoose';
import { GraphQLString } from 'graphql';
//---------- TYPE MODIFICATORS
composeType('User',
composeTypeFromMongoose(UserMongooseModel),
addResolverParam('model', UserMongooseModel), // internally added by `composeTypeFromMongoose`
composeInterface('Timestable'), // internally call composeStorage.Interfaces.get('Timestable')
description('User model description'),
only(['myName', 'surname']), // get only described fields
remove(['stats', 'password']), // ... or leave others, and remove just listed here
rename({
myName: 'name',
surname: 'lastname',
}),
restrict({
hasAccess: (source, args, context, info) => {
return context.isAdmin;
},
fields: ['name', 'dob'],
}),
restrict({