{"size": 886, "ext": "js", "max_stars_repo_path": "api/models/ProductOrder/ProductOrderType.js", "max_stars_repo_name": "Amber-Williams/smartwaiter-server", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api/models/ProductOrder/ProductOrderType.js", "max_issues_repo_name": "Amber-Williams/smartwaiter-server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "api/models/ProductOrder/ProductOrderType.js", "max_forks_repo_name": "Amber-Williams/smartwaiter-server", "max_forks_repo_forks_event_min_datetime": "2018-07-10T18:03:45.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-07T16:43:53.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 7, "avg_line_length": 22.7179487179, "max_line_length": 81, "alphanum_fraction": 0.6399548533}
const {
  GraphQLObjectType,
  GraphQLInt,
  GraphQLString,
  GraphQLFloat,
} = require('graphql');

const ProductType = require('../Product/ProductType');

const ProductOrderType = new GraphQLObjectType({
  name: 'ProductOrderType',
  description:
    'this is the individual order of client - a snapshot of products and prices',
  fields: () => ({
    id: {
      type: GraphQLInt,
      resolve: productorder => productorder.id,
    },
    status: {
      type: GraphQLString,
      resolve: productorder => productorder.status,
    },
    orderId: {
      type: GraphQLInt,
      resolve: productorder => productorder.orderId,
    },
    price: {
      type: GraphQLFloat,
      resolve: productorder => productorder.price,
    },
    product: {
      type: ProductType,
      resolve: productorder => productorder.getProduct(),
    },
  }),
});

module.exports = ProductOrderType;
