Revised which fields are allowed to be null

This commit is contained in:
Alberto Miedes Garcés
2016-09-30 11:49:34 +02:00
parent 78423edb2a
commit afb2d19ab3
4 changed files with 5 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ GeozoneType = GraphQL::ObjectType.define do
name "Geozone" name "Geozone"
description "A geozone entry, returns basic geozone information" description "A geozone entry, returns basic geozone information"
# Expose fields associated with Geozone model # Expose fields associated with Geozone model
field :id, types.ID, "The id of this geozone" field :id, !types.ID, "The id of this geozone"
field :name, types.String, "The name of this geozone" field :name, types.String, "The name of this geozone"
field :html_map_coordinates, types.String, "HTML map coordinates of this geozone" field :html_map_coordinates, types.String, "HTML map coordinates of this geozone"
field :external_code, types.String, "The external code of this geozone" field :external_code, types.String, "The external code of this geozone"

View File

@@ -2,7 +2,7 @@ ProposalType = GraphQL::ObjectType.define do
name "Proposal" name "Proposal"
description "A single proposal entry returns a proposal with author, total votes and comments" description "A single proposal entry returns a proposal with author, total votes and comments"
# Expose fields associated with Proposal model # Expose fields associated with Proposal model
field :id, types.ID, "The id of this proposal" field :id, !types.ID, "The id of this proposal"
field :title, types.String, "The title of this proposal" field :title, types.String, "The title of this proposal"
field :description, types.String, "The description of this proposal" field :description, types.String, "The description of this proposal"
field :question, types.String, "The question of this proposal" field :question, types.String, "The question of this proposal"

View File

@@ -12,7 +12,7 @@ QueryRoot = GraphQL::ObjectType.define do
end end
field :proposals do field :proposals do
type types[ProposalType] type !types[!ProposalType]
description "Find all Proposals" description "Find all Proposals"
resolve -> (object, arguments, context) { resolve -> (object, arguments, context) {
Proposal.all Proposal.all
@@ -29,7 +29,7 @@ QueryRoot = GraphQL::ObjectType.define do
end end
field :comments do field :comments do
type types[CommentType] type !types[!CommentType]
description "Find all Comments" description "Find all Comments"
resolve -> (object, arguments, context) { resolve -> (object, arguments, context) {
Comment.all Comment.all

View File

@@ -2,7 +2,7 @@ UserType = GraphQL::ObjectType.define do
name "User" name "User"
description "An user entry, returns basic user information" description "An user entry, returns basic user information"
# Expose fields associated with User model # Expose fields associated with User model
field :id, types.ID, "The id of this user" field :id, !types.ID, "The id of this user"
field :created_at, types.String, "Date when this user was created" field :created_at, types.String, "Date when this user was created"
field :username, types.String, "The username of this user" field :username, types.String, "The username of this user"
field :geozone_id, types.Int, "The ID of the geozone where this user is active" field :geozone_id, types.Int, "The ID of the geozone where this user is active"