Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add relay #775

Merged
merged 11 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 344 additions & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,344 @@
input CheckPinInput {
pin: String!
}

# Autogenerated return type of CheckPin
type CheckPinPayload {
success: Boolean!
userErrors: [String!]
}

input CreateDivisionInput {
bracketType: String
name: String
numDays: Int
numTeams: Int
}

# Autogenerated return type of CreateDivision
type CreateDivisionPayload {
division: Division!
success: Boolean!
userErrors: [String!]
}

input CreateFieldInput {
geoJson: String
lat: Float
long: Float
name: String
}

# Autogenerated return type of CreateField
type CreateFieldPayload {
field: Field!
success: Boolean!
userErrors: [String!]
}

input CreateTeamInput {
divisionId: ID
email: String
name: String
phone: String
seed: Int
}

# Autogenerated return type of CreateTeam
type CreateTeamPayload {
success: Boolean!
team: Team!
userErrors: [String!]
}

scalar DateTime

input DeleteDivisionInput {
confirm: Boolean
divisionId: ID!
}

# Autogenerated return type of DeleteDivision
type DeleteDivisionPayload {
confirm: Boolean
success: Boolean!
userErrors: [String!]
}

input DeleteFieldInput {
confirm: Boolean
fieldId: ID!
}

# Autogenerated return type of DeleteField
type DeleteFieldPayload {
confirm: Boolean
success: Boolean!
userErrors: [String!]
}

input DeleteTeamInput {
confirm: Boolean
teamId: ID!
}

# Autogenerated return type of DeleteTeam
type DeleteTeamPayload {
confirm: Boolean
notAllowed: Boolean
success: Boolean!
userErrors: [String!]
}

# A Division
type Division {
bracketType: String
id: ID
isSeeded: Boolean
name: String
needsSeed: Boolean
numDays: Int
numTeams: Int
teamsCount: Int
}

# A Field
type Field {
geoJson: String
id: ID
lat: Float
long: Float
name: String
}

# A Game
type Game {
awayName: String
awayScore: Int
division: Division
endTime: DateTime
fieldId: ID
fieldName: String
homeName: String
homeScore: Int
id: ID!
pool: String

# True when a score has been submitted and
# accepted by the tournament as confirmed according to its rules.
# Some tournament require a submission from both teams or a validated
# confirmation.
scoreConfirmed: Boolean!
startTime: DateTime
}

# Tournament Map
type Map {
lat: Float!
long: Float!
zoom: Int!
}

type Mutation {
checkPin(input: CheckPinInput!): CheckPinPayload
createDivision(input: CreateDivisionInput!): CreateDivisionPayload
createField(input: CreateFieldInput!): CreateFieldPayload
createTeam(input: CreateTeamInput!): CreateTeamPayload
deleteDivision(input: DeleteDivisionInput!): DeleteDivisionPayload
deleteField(input: DeleteFieldInput!): DeleteFieldPayload
deleteTeam(input: DeleteTeamInput!): DeleteTeamPayload
scheduleGame(input: ScheduleGameInput!): ScheduleGamePayload
seedDivision(input: SeedDivisionInput!): SeedDivisionPayload
submitScore(input: SubmitScoreInput!): SubmitScorePayload
updateDivision(input: UpdateDivisionInput!): UpdateDivisionPayload
updateField(input: UpdateFieldInput!): UpdateFieldPayload
updateMap(input: UpdateMapInput!): UpdateMapPayload
updateScore(input: UpdateScoreInput!): UpdateScorePayload
updateSettings(input: UpdateSettingsInput!): UpdateSettingsPayload
updateTeam(input: UpdateTeamInput!): UpdateTeamPayload
}

type Query {
division(id: ID!): Division
divisions: [Division!]
field(id: ID!): Field
fields: [Field!]
game(id: ID!): Game
games(hasTeam: Boolean, scheduled: Boolean): [Game!]
map: Map
scoreReport(id: ID!): ScoreReport
scoreReports: [ScoreReport!]
settings: Settings
team(id: ID!): Team
teams: [Team!]
}

input ScheduleGameInput {
endTime: DateTime!
fieldId: ID!
gameId: ID!
startTime: DateTime!
}

# Autogenerated return type of ScheduleGame
type ScheduleGamePayload {
game: Game!
success: Boolean!
userErrors: [String!]
}

# A ScoreReport
type ScoreReport {
attitude: Int!
awayScore: Int!
comment: String
communication: Int!
fairness: Int!
fouls: Int!
homeScore: Int!
id: ID!
rulesKnowledge: Int!
submitterFingerprint: String!
team: Team!
}

input SeedDivisionInput {
confirm: Boolean
divisionId: ID!
seeds: [Int!]
teamIds: [ID!]
}

# Autogenerated return type of SeedDivision
type SeedDivisionPayload {
confirm: Boolean
success: Boolean!
userErrors: [String!]
}

# Tourgraphql_nament Settings
type Settings {
protectScoreSubmit: Boolean!
}

input SubmitScoreInput {
attitude: Int!
awayScore: Int!
comments: String
communication: Int!
fairness: Int!
fouls: Int!
gameId: ID!
homeScore: Int!
rulesKnowledge: Int!
submitterFingerprint: String!
teamId: ID!
}

# Autogenerated return type of SubmitScore
type SubmitScorePayload {
success: Boolean!
}

# A Team
type Team {
division: Division
divisionId: Int
email: String
id: ID
name: String
phone: String
seed: Int
}

input UpdateDivisionInput {
bracketType: String
confirm: Boolean
divisionId: ID!
name: String
numDays: Int
numTeams: Int
}

# Autogenerated return type of UpdateDivision
type UpdateDivisionPayload {
confirm: Boolean
division: Division!
success: Boolean!
userErrors: [String!]
}

input UpdateFieldInput {
fieldId: ID!
geoJson: String
lat: Float
long: Float
name: String
}

# Autogenerated return type of UpdateField
type UpdateFieldPayload {
field: Field!
success: Boolean!
userErrors: [String!]
}

input UpdateMapInput {
lat: Float!
long: Float!
zoom: Int!
}

# Autogenerated return type of UpdateMap
type UpdateMapPayload {
success: Boolean!
}

input UpdateScoreInput {
awayScore: Int!
force: Boolean
gameId: ID!
homeScore: Int!
resolve: Boolean
}

# Autogenerated return type of UpdateScore
type UpdateScorePayload {
success: Boolean!
userErrors: [String!]
}

input UpdateSettingsInput {
confirm: Boolean
gameConfirmSetting: String
handle: String
name: String
scoreSubmitPin: Int
timezone: String
}

# Autogenerated return type of UpdateSettings
type UpdateSettingsPayload {
confirm: Boolean
success: Boolean!
userErrors: [String!]
}

input UpdateTeamInput {
confirm: Boolean
divisionId: ID
email: String
name: String
phone: String
seed: Int
teamId: ID!
}

# Autogenerated return type of UpdateTeam
type UpdateTeamPayload {
confirm: Boolean
notAllowed: Boolean
success: Boolean!
team: Team!
userErrors: [String!]
}
15 changes: 15 additions & 0 deletions app/graphql/types/division.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,19 @@ class Types::Division < Types::BaseObject
field :numTeams, Int, null: true
field :numDays, Int, null: true
field :bracketType, String, null: true
field :teamsCount, Int, null: true
field :isSeeded, Boolean, null: true
field :needsSeed, Boolean, null: true

def teams_count
object.teams.count
end

def is_seeded
object.seeded?
end

def needs_seed
object.dirty_seed?
end
end
2 changes: 2 additions & 0 deletions app/graphql/types/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class Types::Game < Types::BaseObject
description "A Game"

field :id, ID, null: false
field :division, Types::Division, null: true
field :pool, String, null: true
field :homeName, String, null: true
field :awayName, String, null: true
field :fieldId, ID, null: true
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/map.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Types::Map < Types::BaseObject
graphql_name "Map"
description "Tourgraphql_nament Map"
description "Tournament Map"
field :lat, Float, null: false
field :long, Float, null: false
field :zoom, Int, null: false
Expand Down
1 change: 1 addition & 0 deletions app/graphql/types/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ class Types::Team < Types::BaseObject
field :email, String, auth: :required, null: true
field :phone, String, auth: :required, null: true
field :divisionId, Int, null: true
field :division, Types::Division, null: true
field :seed, Int, null: true
end
3 changes: 3 additions & 0 deletions clients/admin_next/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# production
/build

# relay
*__generated__

# misc
.DS_Store
.env.local
Expand Down
Loading