Skip to content

Instantly share code, notes, and snippets.

@pedro
Last active February 1, 2017 23:30
Show Gist options
  • Save pedro/92981e49d3039c0133da92994c346c9d to your computer and use it in GitHub Desktop.
Save pedro/92981e49d3039c0133da92994c346c9d to your computer and use it in GitHub Desktop.
+++ b/app/graph/types/day_of_the_week_enum.rb
@@ -0,0 +1,10 @@
+DayOfTheWeekEnum = GraphQL::EnumType.define do
+ name "Day of the week"
+ value("MONDAY", "Monday", value: 1)
+ value("TUESDAY", "Tuesday", value: 2)
+ value("WEDNESDAY", "Wednesday", value: 3)
+ value("THURSDAY", "Thursday", value: 4)
+ value("FRIDAY", "Friday", value: 5)
+ value("SATURDAY", "Saturday", value: 6)
+ value("SUNDAY", "Sunday", value: 0)
+end
diff --git a/app/graph/types/lugger_type.rb b/app/graph/types/lugger_type.rb
index 27d7216..d3b84e3 100644
--- a/app/graph/types/lugger_type.rb
+++ b/app/graph/types/lugger_type.rb
@@ -5,7 +5,7 @@ LuggerType = GraphQL::ObjectType.define do
camelized_field :id, !types.ID
camelized_field :first_name, !types.String, "First name of the lugger"
camelized_field :last_name, !types.String, "Last name of the lugger"
- camelized_field :available_days_of_the_week, types[types.Int], "array of days of the week available for taking slots (0 is Sunday)"
+ camelized_field :available_days_of_the_week, types[DayOfTheWeekEnum], "array of days of the week available for taking slots (0 is Sunday)"
camelized_field :avatar_url, types.String, "URL to a picture of the lugger"
camelized_field :rating, types.Float, "Current rating of the lugger"
camelized_field :phone_number, types.String, "Phone number of the lugger"
diff --git a/app/graph/types/lugger_update_mutation.rb b/app/graph/types/lugger_update_mutation.rb
index 618a2a0..79893ab 100644
--- a/app/graph/types/lugger_update_mutation.rb
+++ b/app/graph/types/lugger_update_mutation.rb
@@ -1,7 +1,7 @@
LuggerUpdateMutation = GraphQL::Relay::Mutation.define do
name "LuggerUpdate"
- input_field :availableDaysOfTheWeek, types[types.Int]
+ input_field :availableDaysOfTheWeek, types[DayOfTheWeekEnum]
input_field :contractorAgreementAcceptedAt, DateTimeType
input_field :zoneId, types.ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment