Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Sep 21, 2023
1 parent f20cd6b commit 09ccacd
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/graph/types/project_media_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def log(event_types: nil, field_names: nil, annotation_types: nil, who_dunnit: n
object.get_versions_log(event_types, field_names, annotation_types, who_dunnit, include_related)
end

field :flags, FlagType.connection_type, null: true

def flags
object.get_annotations('flag').map(&:load)
end

field :tags, TagType.connection_type, null: true

def tags
Expand Down
3 changes: 0 additions & 3 deletions app/models/annotations/flag.rb

This file was deleted.

57 changes: 57 additions & 0 deletions lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -8532,6 +8532,42 @@ type Flag implements Node {
version: Version
}

"""
The connection type for Flag.
"""
type FlagConnection {
"""
A list of edges.
"""
edges: [FlagEdge]

"""
A list of nodes.
"""
nodes: [Flag]

"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
totalCount: Int
}

"""
An edge in a connection.
"""
type FlagEdge {
"""
A cursor for use in pagination.
"""
cursor: String!

"""
The item at the end of the edge.
"""
node: Flag
}

"""
Autogenerated input type of GenerateTwoFactorBackupCodes
"""
Expand Down Expand Up @@ -11100,6 +11136,27 @@ type ProjectMedia implements Node {
): DynamicConnection
feed_columns_values: JsonStringType
field_value(annotation_type_field_name: String!): String
flags(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String

"""
Returns the first _n_ elements from the list.
"""
first: Int

"""
Returns the last _n_ elements from the list.
"""
last: Int
): FlagConnection
full_url: String
id: ID!
is_confirmed: Boolean
Expand Down
187 changes: 187 additions & 0 deletions public/relay.json
Original file line number Diff line number Diff line change
Expand Up @@ -46592,6 +46592,132 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "FlagConnection",
"description": "The connection type for Flag.",
"fields": [
{
"name": "edges",
"description": "A list of edges.",
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FlagEdge",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "nodes",
"description": "A list of nodes.",
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Flag",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pageInfo",
"description": "Information to aid in pagination.",
"args": [

],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalCount",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [

],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "FlagEdge",
"description": "An edge in a connection.",
"fields": [
{
"name": "cursor",
"description": "A cursor for use in pagination.",
"args": [

],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "node",
"description": "The item at the end of the edge.",
"args": [

],
"type": {
"kind": "OBJECT",
"name": "Flag",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [

],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "GenerateTwoFactorBackupCodesInput",
Expand Down Expand Up @@ -58297,6 +58423,67 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "flags",
"description": null,
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "OBJECT",
"name": "FlagConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "full_url",
"description": null,
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/graphql_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def setup
authenticate_with_user(u)
pm = create_project_media
create_flag annotated: pm
query = "query GetById { project_media(ids: \"#{pm.id},nil,#{pm.team_id}\") { source { id }, annotation(annotation_type: \"flag\") { project_media { id } }, annotations(annotation_type: \"flag\") { edges { node { ... on Flag { id } } } } } }"
query = "query GetById { project_media(ids: \"#{pm.id},nil,#{pm.team_id}\") { source { id }, flags(first: 10) { edges { node { id } } }, annotation(annotation_type: \"flag\") { project_media { id } }, annotations(annotation_type: \"flag\") { edges { node { ... on Flag { id } } } } } }"
post :create, params: { query: query, team: pm.team.slug }
assert_response :success
end
Expand Down

0 comments on commit 09ccacd

Please sign in to comment.