Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 7x |
// const test = {
// scope: [ENUMS.USER_TYPE.ADMIN.key, ENUMS.USER_TYPE.USER.key],
// type: RelationshipType,
// args: {
// message: {
// type: new GraphQLNonNull(GraphQLString)
// },
// userId: {
// type: new GraphQLNonNull(GraphQLInt)
// },
// friendId: {
// type: new GraphQLNonNull(GraphQLInt)
// },
// email: {
// type: new GraphQLNonNull(GraphQLString)
// }
// },
// resolve: (root, { userId, friendId, email }, context: Credential) => {
// return Relationship.create({
// userId: userId,
// friendId: friendId,
// lastEditedBy: context.user.id,
// status: ENUMS.STATUS.PENDING.key,
// email: email || ''
// });
// }
// };
// ;
export function Args(arg): Function {
Object.keys(arg).forEach(a => {
arg[a] = {type: arg[a]};
});
const originalDecoratorArguments = {args: arg};
return (t: any, propertyName: string, descriptor) => {
const target = t;
const originalMethod = descriptor.value;
descriptor.value = function (...args: any[]) {
let result = originalMethod.apply(args);
result = {...originalDecoratorArguments, ...result};
return result;
};
return descriptor;
};
} |