Files
node_learning_module_1/day11/resolvers/single/singleReferLog.js
T

25 lines
696 B
JavaScript
Raw Normal View History

2022-02-06 22:15:10 -05:00
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* refer_log Resolve Single
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError } = require('apollo-server-express');
const graphqlFields = require('graphql-fields');
module.exports = async (_, {id}, {db}, info) => {
try {
const attributes = db.refer_log.intersection(graphqlFields(info));
return await db.refer_log.getByPK(id);
} catch (error) {
console.log('single_refer_log -> error', error);
return new ApolloError('InternalServerError');
}
};