Skip to content

Commit

Permalink
CV2-4072: limit UserType fields to required fields only
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Jan 15, 2024
1 parent e7ba300 commit 43247cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 111 deletions.
27 changes: 10 additions & 17 deletions app/graph/types/user_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,27 @@ class UserType < DefaultObject

field :dbid, GraphQL::Types::Int, null: true
field :email, GraphQL::Types::String, null: true
field :providers, JsonStringType, null: true
field :profile_image, GraphQL::Types::String, null: true
field :login, GraphQL::Types::String, null: true
field :name, GraphQL::Types::String, null: true
field :current_team_id, GraphQL::Types::Int, null: true
field :permissions, GraphQL::Types::String, null: true
field :number_of_teams, GraphQL::Types::Int, null: true
field :is_active, GraphQL::Types::Boolean, null: true
field :accepted_terms, GraphQL::Types::Boolean, null: true
field :last_accepted_terms_at, GraphQL::Types::String, null: true
field :team_ids, [GraphQL::Types::Int, null: true], null: true
field :last_active_at, GraphQL::Types::Int, null: true
field :completed_signup, GraphQL::Types::Boolean, null: true
field :source_id, GraphQL::Types::Int, null: true
field :is_bot, GraphQL::Types::Boolean, null: true

field :current_team, TeamType, null: true

def current_team
User.current == object ? object.current_team : nil
end
field :is_active, GraphQL::Types::Boolean, null: true
field :number_of_teams, GraphQL::Types::Int, null: true
field :accepted_terms, GraphQL::Types::Boolean, null: true
field :current_team_id, GraphQL::Types::Int, null: true

field :source, SourceType, null: true

def source
Source.find(object.source_id)
end

field :current_team, TeamType, null: true

def current_team
User.current == object ? object.current_team : nil
end

field :team_user, TeamUserType, null: true do
argument :team_slug, GraphQL::Types::String, required: true, camelize: false
end
Expand Down
6 changes: 0 additions & 6 deletions lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -15714,7 +15714,6 @@ User type
"""
type User implements Node {
accepted_terms: Boolean
completed_signup: Boolean
created_at: String
current_team: Team
current_team_id: Int
Expand All @@ -15723,17 +15722,12 @@ type User implements Node {
id: ID!
is_active: Boolean
is_bot: Boolean
last_accepted_terms_at: String
last_active_at: Int
login: String
name: String
number_of_teams: Int
permissions: String
profile_image: String
providers: JsonStringType
source: Source
source_id: Int
team_ids: [Int]
team_user(team_slug: String!): TeamUser
team_users(
"""
Expand Down
88 changes: 0 additions & 88 deletions public/relay.json
Original file line number Diff line number Diff line change
Expand Up @@ -86572,20 +86572,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "completed_signup",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "created_at",
"description": null,
Expand Down Expand Up @@ -86702,20 +86688,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last_accepted_terms_at",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last_active_at",
"description": null,
Expand All @@ -86730,20 +86702,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "login",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": null,
Expand Down Expand Up @@ -86800,20 +86758,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "providers",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "JsonStringType",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "source",
"description": null,
Expand All @@ -86828,38 +86772,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "source_id",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "team_ids",
"description": null,
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "team_user",
"description": null,
Expand Down

0 comments on commit 43247cb

Please sign in to comment.