<commit_before>/**
 * Created by axetroy on 17-7-13.
 */
import {
  GraphQLObjectType,
  GraphQLNonNull,
  GraphQLString,
  GraphQLID,
  GraphQLBoolean,
  GraphQLList,
  GraphQLInt,
  GraphQLInputObjectType
} from 'graphql';

import { getUserInfo } from '../../controllers/user';

export const user = {
  type: new GraphQLObjectType({
    name: 'UserInfoType',
    fields: {
      uid: {
        type: GraphQLString
      },
      username: {
        type: GraphQLString
      }
    }
  }),
  async resolve(parent: any, params: any, req: any) {
    const uid: string = parent.uid;
    let userInfo = {};
    try {
      userInfo = await getUserInfo(uid);
    } catch (err) {
      console.error(err);
    }
    return userInfo;
  }
};

export const UserType = new GraphQLObjectType({
  name: 'UserType',
  fields: {
    uid: {
      type: new GraphQLNonNull(GraphQLString)
    },
    username: {
      type: new GraphQLNonNull(GraphQLString)
    },
    nickname: {
      type: new GraphQLNonNull(GraphQLString)
    },
    createdAt: {
      type: new GraphQLNonNull(GraphQLString)
    },
    updatedAt: {<commit_msg>feat: 用户接口新增加nickname返回字段<commit_after>/**
 * Created by axetroy on 17-7-13.
 */
import {
  GraphQLObjectType,
  GraphQLNonNull,
  GraphQLString,
  GraphQLID,
  GraphQLBoolean,
  GraphQLList,
  GraphQLInt,
  GraphQLInputObjectType
} from 'graphql';

import { getUserInfo } from '../../controllers/user';

export const user = {
  type: new GraphQLObjectType({
    name: 'UserInfoType',
    fields: {
      uid: {
        type: new GraphQLNonNull(GraphQLString)
      },
      username: {
        type: new GraphQLNonNull(GraphQLString)
      },
      nickname: {
        type: new GraphQLNonNull(GraphQLString)
      }
    }
  }),
  async resolve(parent: any, params: any, req: any) {
    const uid: string = parent.uid;
    let userInfo = {};
    try {
      userInfo = await getUserInfo(uid);
    } catch (err) {
      console.error(err);
    }
    return userInfo;
  }
};

export const UserType = new GraphQLObjectType({
  name: 'UserType',
  fields: {
    uid: {
      type: new GraphQLNonNull(GraphQLString)
    },
    username: {
      type: new GraphQLNonNull(GraphQLString)
    },
    nickname: {
      type: new GraphQLNonNull(GraphQLString)
    },
    createdAt: {
      type: new GraphQLNonNull(GraphQLString)
    },
    updatedAt: {
{'fraction_non_alphanumeric': 0.11784654514624841, 'fraction_numerical': 0.00423908435777872, 'mean_word_length': 2.5866261398176293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7524887', 'n_tokens_mistral': 790, 'n_tokens_neox': 802, 'n_words': 173}