-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Refactor graphql ruby with class name style
- Loading branch information
1 parent
d17f717
commit a41520f
Showing
15 changed files
with
105 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
module Refinery | ||
module Api | ||
module Mutations | ||
module Pages | ||
class Create < GraphQL::Schema::Mutation | ||
name 'CreatePage' | ||
description 'Create a page' | ||
|
||
input_field :page, !Inputs::Pages::PageInput | ||
|
||
return_field :page, Types::Pages::PageType | ||
|
||
resolve -> (obj, inputs, ctx) { | ||
inputs = inputs.to_h.deep_symbolize_keys | ||
|
||
page = Refinery::Page.create!(inputs[:page]) | ||
|
||
{ page: page } | ||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module Refinery | ||
module Api | ||
module Mutations | ||
module Pages | ||
class Delete < GraphQL::Schema::Mutation | ||
name 'DeletePage' | ||
|
||
input_field :id, !types.ID | ||
|
||
return_field :page, Types::Pages::PageType | ||
|
||
resolve -> (obj, inputs, ctx) { | ||
page = Refinery::Page.destroy(inputs[:id]) | ||
|
||
{ page: page } | ||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
60 changes: 0 additions & 60 deletions
60
api/app/graph/refinery/api/mutations/pages/page_mutations.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Refinery | ||
module Api | ||
module Mutations | ||
module Pages | ||
class Update < GraphQL::Schema::Mutation | ||
name 'UpdatePage' | ||
description 'Create a page' | ||
|
||
input_field :id, !types.ID | ||
input_field :page, !Inputs::Pages::PageInput | ||
|
||
return_field :page, Types::Pages::PageType | ||
|
||
resolve -> (obj, inputs, ctx) { | ||
inputs = inputs.to_h.deep_symbolize_keys | ||
|
||
page = Refinery::Page.update(inputs[:id], inputs[:page]) | ||
|
||
{ page: page } | ||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Refinery | ||
module Api | ||
module Types | ||
class BaseInterface | ||
include GraphQL::Schema::Interface | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Refinery | ||
module Api | ||
module Types | ||
class BaseObject < GraphQL::Schema::Object | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters