From 91de8b665579bb79773563b020a76d2d0159d2b4 Mon Sep 17 00:00:00 2001 From: Brice Sanchez Date: Fri, 7 Sep 2018 07:52:55 -0400 Subject: [PATCH] Fix bugs on mutations --- .../refinery/api/graphql_controller.rb | 2 +- api/app/graph/refinery/api/types/date_type.rb | 24 ------------------- .../api/types/pages/page_attributes.rb | 4 ++-- .../refinery/api/types/pages/page_type.rb | 1 + 4 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 api/app/graph/refinery/api/types/date_type.rb diff --git a/api/app/controllers/refinery/api/graphql_controller.rb b/api/app/controllers/refinery/api/graphql_controller.rb index a8ac6056bd..4ed40614d5 100644 --- a/api/app/controllers/refinery/api/graphql_controller.rb +++ b/api/app/controllers/refinery/api/graphql_controller.rb @@ -1,6 +1,6 @@ module Refinery module Api - class GraphqlController < ApplicationController + class GraphqlController < ::ApplicationController def execute variables = ensure_hash(params[:variables]) query = params[:query] diff --git a/api/app/graph/refinery/api/types/date_type.rb b/api/app/graph/refinery/api/types/date_type.rb deleted file mode 100644 index f61062966c..0000000000 --- a/api/app/graph/refinery/api/types/date_type.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -module Refinery - module Api - module Types - DateType = GraphQL::ScalarType.define do - graphql_name "Date" - description "Valid date format (parsable by Ruby's Date.parse)" - - coerce_input -> (value, context) do - begin Date.parse(value) - value.to_datetime - rescue ArgumentError => error - context.errors << error.message - end - end - - coerce_result -> (value, context) do - value.to_datetime - end - end - end - end -end \ No newline at end of file diff --git a/api/app/graph/refinery/api/types/pages/page_attributes.rb b/api/app/graph/refinery/api/types/pages/page_attributes.rb index 1693304635..c4ecf93426 100644 --- a/api/app/graph/refinery/api/types/pages/page_attributes.rb +++ b/api/app/graph/refinery/api/types/pages/page_attributes.rb @@ -16,7 +16,7 @@ class PageAttributes < Types::BaseInputObject argument :draft, Boolean, required: false argument :skip_to_first_child, Boolean, required: false argument :lft, Integer, required: false - argument :rgt, required: false + argument :rgt, Integer, required: false argument :depth, Integer, required: false argument :view_template, String, required: false argument :layout_template, String, required: false @@ -28,7 +28,7 @@ class PageAttributes < Types::BaseInputObject argument :meta_description, String, required: false argument :browser_title, String, required: false - argument :parts, [Types::PagePart], required: false + argument :parts, [PagePartAttributes], required: false end end end diff --git a/api/app/graph/refinery/api/types/pages/page_type.rb b/api/app/graph/refinery/api/types/pages/page_type.rb index 8e49209ec0..c0e37b1d70 100644 --- a/api/app/graph/refinery/api/types/pages/page_type.rb +++ b/api/app/graph/refinery/api/types/pages/page_type.rb @@ -28,6 +28,7 @@ class PageType < GraphQL::Schema::Object field :slug, String, null: true field :meta_description, String, null: true field :browser_title, String, null: true + field :parts, [PagePartType], null: true end end