Skip to content

Instantly share code, notes, and snippets.

@holmesal
Created August 17, 2016 04:36
Show Gist options
  • Save holmesal/3b05b02740d47157432fa309ce25ff20 to your computer and use it in GitHub Desktop.
Save holmesal/3b05b02740d47157432fa309ce25ff20 to your computer and use it in GitHub Desktop.
import { GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList } from 'graphql';
import { globalIdField } from 'graphql-relay';
import CityDayType from '../../CityDay/types/CityDay';
import AccommodationPlacementType from '../../Supplier/types/AccommodationPlacement';
export default new GraphQLObjectType({
name: 'CityBooking',
description: 'The city booking object in Quickplan',
fields: () => ({
id: globalIdField('CityBooking', city => city._key),
_key: {
type: GraphQLString,
description: 'Unique city booking ID.'
},
cityCode: {
type: GraphQLString
},
startDay: {
type: GraphQLInt,
resolve: cityBooking => controller.getCountryBookingById(cityBooking.countryId).then(countryBooking => return countryBooking.startDay);
},
durationNights: {
type: GraphQLInt
},
cityOrder: {
type: GraphQLInt
},
cityDays: {
type: new GraphQLList(CityDayType)
},
accommodationPlacements: {
type: new GraphQLList(AccommodationPlacementType)
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment