@@ 43,6 43,11 @@ type DirectiveRoot struct {
}
type ComplexityRoot struct {
+ MapVote struct {
+ Maps func(childComplexity int) int
+ Status func(childComplexity int) int
+ }
+
Mutation struct {
CancelMatch func(childComplexity int) int
CancelQueue func(childComplexity int, teamspeakID string) int
@@ 52,6 57,7 @@ type ComplexityRoot struct {
FinishMatch func(childComplexity int, winner string) int
StartQueue func(childComplexity int, teamspeakID string) int
UpdateUser func(childComplexity int, id int, input model.UserInput) int
+ VetoMap func(childComplexity int, mapArg *string) int
}
Query struct {
@@ 85,6 91,7 @@ type MutationResolver interface {
CreateMatch(ctx context.Context) (int, error)
CancelMatch(ctx context.Context) (string, error)
FinishMatch(ctx context.Context, winner string) (string, error)
+ VetoMap(ctx context.Context, mapArg *string) (*model.MapVote, error)
}
type QueryResolver interface {
UserBySteam(ctx context.Context, steamID string) (*model.User, error)
@@ 107,6 114,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
_ = ec
switch typeName + "." + field {
+ case "MapVote.maps":
+ if e.complexity.MapVote.Maps == nil {
+ break
+ }
+
+ return e.complexity.MapVote.Maps(childComplexity), true
+
+ case "MapVote.status":
+ if e.complexity.MapVote.Status == nil {
+ break
+ }
+
+ return e.complexity.MapVote.Status(childComplexity), true
+
case "Mutation.cancelMatch":
if e.complexity.Mutation.CancelMatch == nil {
break
@@ 193,6 214,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.UpdateUser(childComplexity, args["id"].(int), args["input"].(model.UserInput)), true
+ case "Mutation.vetoMap":
+ if e.complexity.Mutation.VetoMap == nil {
+ break
+ }
+
+ args, err := ec.field_Mutation_vetoMap_args(context.TODO(), rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Mutation.VetoMap(childComplexity, args["map"].(*string)), true
+
case "Query.getTeams":
if e.complexity.Query.GetTeams == nil {
break
@@ 371,6 404,12 @@ type Teams {
team2: [User!]!
}
+type MapVote {
+ maps: [String!]!
+ # status: TEAM1, TEAM2, DONE
+ status: String!
+}
+
type Query {
userBySteam(steamID: String!): User
userByTS(teamspeakID: String!): User
@@ 400,6 439,7 @@ type Mutation {
createMatch: Int!
cancelMatch: String!
finishMatch(winner: String!): String!
+ vetoMap(map: String): MapVote!
}
`, BuiltIn: false},
}
@@ 508,6 548,21 @@ func (ec *executionContext) field_Mutation_updateUser_args(ctx context.Context,
return args, nil
}
+func (ec *executionContext) field_Mutation_vetoMap_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
+ var err error
+ args := map[string]interface{}{}
+ var arg0 *string
+ if tmp, ok := rawArgs["map"]; ok {
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("map"))
+ arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["map"] = arg0
+ return args, nil
+}
+
func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
@@ 606,6 661,76 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg
// region **************************** field.gotpl *****************************
+func (ec *executionContext) _MapVote_maps(ctx context.Context, field graphql.CollectedField, obj *model.MapVote) (ret graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ fc := &graphql.FieldContext{
+ Object: "MapVote",
+ Field: field,
+ Args: nil,
+ IsMethod: false,
+ IsResolver: false,
+ }
+
+ ctx = graphql.WithFieldContext(ctx, fc)
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Maps, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.([]string)
+ fc.Result = res
+ return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
+}
+
+func (ec *executionContext) _MapVote_status(ctx context.Context, field graphql.CollectedField, obj *model.MapVote) (ret graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ fc := &graphql.FieldContext{
+ Object: "MapVote",
+ Field: field,
+ Args: nil,
+ IsMethod: false,
+ IsResolver: false,
+ }
+
+ ctx = graphql.WithFieldContext(ctx, fc)
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
+ ctx = rctx // use context from middleware stack in children
+ return obj.Status, nil
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalNString2string(ctx, field.Selections, res)
+}
+
func (ec *executionContext) _Mutation_createUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
@@ 925,6 1050,48 @@ func (ec *executionContext) _Mutation_finishMatch(ctx context.Context, field gra
return ec.marshalNString2string(ctx, field.Selections, res)
}
+func (ec *executionContext) _Mutation_vetoMap(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = graphql.Null
+ }
+ }()
+ fc := &graphql.FieldContext{
+ Object: "Mutation",
+ Field: field,
+ Args: nil,
+ IsMethod: true,
+ IsResolver: true,
+ }
+
+ ctx = graphql.WithFieldContext(ctx, fc)
+ rawArgs := field.ArgumentMap(ec.Variables)
+ args, err := ec.field_Mutation_vetoMap_args(ctx, rawArgs)
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ fc.Args = args
+ resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
+ ctx = rctx // use context from middleware stack in children
+ return ec.resolvers.Mutation().VetoMap(rctx, args["map"].(*string))
+ })
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ if resTmp == nil {
+ if !graphql.HasFieldError(ctx, fc) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ res := resTmp.(*model.MapVote)
+ fc.Result = res
+ return ec.marshalNMapVote2ᚖgitᚗxenroxᚗnetᚋאxenroxᚋ10manᚑapiᚋgraphᚋmodelᚐMapVote(ctx, field.Selections, res)
+}
+
func (ec *executionContext) _Query_userBySteam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
@@ 2649,6 2816,38 @@ func (ec *executionContext) unmarshalInputUserInput(ctx context.Context, obj int
// region **************************** object.gotpl ****************************
+var mapVoteImplementors = []string{"MapVote"}
+
+func (ec *executionContext) _MapVote(ctx context.Context, sel ast.SelectionSet, obj *model.MapVote) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, mapVoteImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ var invalids uint32
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("MapVote")
+ case "maps":
+ out.Values[i] = ec._MapVote_maps(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ invalids++
+ }
+ case "status":
+ out.Values[i] = ec._MapVote_status(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch()
+ if invalids > 0 {
+ return graphql.Null
+ }
+ return out
+}
+
var mutationImplementors = []string{"Mutation"}
func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
@@ 2701,6 2900,11 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
if out.Values[i] == graphql.Null {
invalids++
}
+ case "vetoMap":
+ out.Values[i] = ec._Mutation_vetoMap(ctx, field)
+ if out.Values[i] == graphql.Null {
+ invalids++
+ }
default:
panic("unknown field " + strconv.Quote(field.Name))
}
@@ 3141,6 3345,20 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti
return res
}
+func (ec *executionContext) marshalNMapVote2gitᚗxenroxᚗnetᚋאxenroxᚋ10manᚑapiᚋgraphᚋmodelᚐMapVote(ctx context.Context, sel ast.SelectionSet, v model.MapVote) graphql.Marshaler {
+ return ec._MapVote(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNMapVote2ᚖgitᚗxenroxᚗnetᚋאxenroxᚋ10manᚑapiᚋgraphᚋmodelᚐMapVote(ctx context.Context, sel ast.SelectionSet, v *model.MapVote) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ return ec._MapVote(ctx, sel, v)
+}
+
func (ec *executionContext) unmarshalNNewUser2gitᚗxenroxᚗnetᚋאxenroxᚋ10manᚑapiᚋgraphᚋmodelᚐNewUser(ctx context.Context, v interface{}) (model.NewUser, error) {
res, err := ec.unmarshalInputNewUser(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
@@ 3161,6 3379,42 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
return res
}
+func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
+ var vSlice []interface{}
+ if v != nil {
+ if tmp1, ok := v.([]interface{}); ok {
+ vSlice = tmp1
+ } else {
+ vSlice = []interface{}{v}
+ }
+ }
+ var err error
+ res := make([]string, len(vSlice))
+ for i := range vSlice {
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
+ res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
+ if err != nil {
+ return nil, err
+ }
+ }
+ return res, nil
+}
+
+func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
+ ret := make(graphql.Array, len(v))
+ for i := range v {
+ ret[i] = ec.marshalNString2string(ctx, sel, v[i])
+ }
+
+ for _, e := range ret {
+ if e == graphql.Null {
+ return graphql.Null
+ }
+ }
+
+ return ret
+}
+
func (ec *executionContext) marshalNTeams2gitᚗxenroxᚗnetᚋאxenroxᚋ10manᚑapiᚋgraphᚋmodelᚐTeams(ctx context.Context, sel ast.SelectionSet, v model.Teams) graphql.Marshaler {
return ec._Teams(ctx, sel, &v)
}