From c7b651aeec2da2ac35d2d6214f85e93f0fe877b3 Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Fri, 24 Oct 2025 16:12:18 +0200 Subject: [PATCH] feat: workflow removed --- .devcontainer/devcontainer.json | 39 +- cmd/root.go | 1 - cmd/server.go | 1 - graph/constraints.graphqls | 2 + graph/constraints.resolvers.go | 2 +- graph/exam.resolvers.go | 2 +- graph/generated/generated.go | 590 ++++-------------------------- graph/invigilation.resolvers.go | 2 +- graph/nta.resolvers.go | 2 +- graph/plan.resolvers.go | 2 +- graph/primuss.resolvers.go | 2 +- graph/room.resolvers.go | 2 +- graph/semesterconfig.resolvers.go | 2 +- graph/studentregs.resolvers.go | 2 +- graph/workflow.graphqls | 13 - graph/workflow.resolvers.go | 21 -- graph/zpa.resolvers.go | 2 +- plexams/plexams.go | 2 - plexams/workflow.go | 52 --- 19 files changed, 115 insertions(+), 626 deletions(-) delete mode 100644 graph/workflow.graphqls delete mode 100644 graph/workflow.resolvers.go delete mode 100644 plexams/workflow.go diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3ec5b2f..d2ef378 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,13 +3,11 @@ "build": { "dockerfile": "Dockerfile" }, - "features": { "ghcr.io/devcontainers/features/go:1": { "version": "1.25.1" } }, - "customizations": { "vscode": { "extensions": [ @@ -22,18 +20,27 @@ "settings": { "go.useLanguageServer": true, "go.lintTool": "golangci-lint-v2", - "go.lintFlags": ["--path-mode=abs", "--fast-only"], + "go.lintFlags": [ + "--path-mode=abs", + "--fast-only" + ], "go.formatTool": "custom", "go.alternateTools": { "customFormatter": "golangci-lint-v2" }, - "go.formatFlags": ["fmt", "--stdin"], + "go.formatFlags": [ + "fmt", + "--stdin" + ], "go.testOnSave": true, "editor.formatOnSave": true, "editor.tabSize": 4, "editor.insertSpaces": true, "editor.detectIndentation": true, - "editor.rulers": [80, 120], + "editor.rulers": [ + 80, + 120 + ], "files.exclude": { "**/.git": true, "**/.svn": true, @@ -46,29 +53,31 @@ } } }, - "mounts": [ "source=shared-binaries,target=/shared/bin,type=volume", + "source=pruefungsplanung-semester,target=/home/vscode/semester,type=volume", + // "source=${localEnv:HOME}/semester,target=/home/vscode/semester,type=bind,consistency=cached", "source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached", "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached", - "source=${localEnv:HOME}/.plexams.yml,target=/home/vscode/.plexams.yml,type=bind,consistency=cached", - "source=${localEnv:HOME}/semester,target=/home/vscode/semester,type=bind,consistency=cached" + "source=${localEnv:HOME}/.plexams.yml,target=/home/vscode/.plexams.yml,type=bind,consistency=cached" + ], + "forwardPorts": [ + 8080, + 8081, + 8082 ], - - "forwardPorts": [8080, 8081, 8082], "portsAttributes": { "8080": { "label": "Application", "onAutoForward": "notify" } }, - "postCreateCommand": "sudo chown -R vscode:vscode /shared/bin && go mod download", - "remoteEnv": { "GOBIN": "/shared/bin", "PATH": "${containerEnv:PATH}:/shared/bin" }, - - "runArgs": ["--network=host"] -} + "runArgs": [ + "--network=host" + ] +} \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 1e24b8e..ac90033 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -25,7 +25,6 @@ var ( Long: `Planing exams.`, Run: func(cmd *cobra.Command, args []string) { plexams := initPlexamsConfig() - plexams.PrintWorkflow() graph.StartServer(plexams, viper.GetString("server.port")) }, PersistentPreRun: func(cmd *cobra.Command, args []string) { diff --git a/cmd/server.go b/cmd/server.go index 711f255..73cdd98 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -12,7 +12,6 @@ var serverCmd = &cobra.Command{ Long: `Start GraphQL-Server.`, Run: func(cmd *cobra.Command, args []string) { plexams := initPlexamsConfig() - plexams.PrintWorkflow() graph.StartServer(plexams, viper.GetString("server.port")) }, } diff --git a/graph/constraints.graphqls b/graph/constraints.graphqls index 6fb0e88..d6cde08 100644 --- a/graph/constraints.graphqls +++ b/graph/constraints.graphqls @@ -1,3 +1,5 @@ +scalar Time + extend type Query { constraintForAncode(ancode: Int!): Constraints zpaExamsToPlanWithConstraints: [ZPAExamWithConstraints!]! diff --git a/graph/constraints.resolvers.go b/graph/constraints.resolvers.go index f3be1ea..fcacfec 100644 --- a/graph/constraints.resolvers.go +++ b/graph/constraints.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/exam.resolvers.go b/graph/exam.resolvers.go index 8c322a9..e69b4c9 100644 --- a/graph/exam.resolvers.go +++ b/graph/exam.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/generated/generated.go b/graph/generated/generated.go index 9912d7a..c45f137 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -378,7 +378,6 @@ type ComplexityRoot struct { InvigilatorsForDay func(childComplexity int, day int) int InvigilatorsWithReq func(childComplexity int) int MucdaiExams func(childComplexity int) int - NextDeadline func(childComplexity int) int Nta func(childComplexity int, mtknr string) int Ntas func(childComplexity int) int NtasWithRegs func(childComplexity int) int @@ -405,7 +404,6 @@ type ComplexityRoot struct { StudentsByName func(childComplexity int, regex string) int Teacher func(childComplexity int, id int) int Teachers func(childComplexity int, fromZpa *bool) int - Workflow func(childComplexity int) int ZpaAnCodes func(childComplexity int) int ZpaExam func(childComplexity int, ancode int) int ZpaExams func(childComplexity int, fromZpa *bool) int @@ -491,13 +489,6 @@ type ComplexityRoot struct { Start func(childComplexity int) int } - Step struct { - Deadline func(childComplexity int) int - Done func(childComplexity int) int - Name func(childComplexity int) int - Number func(childComplexity int) int - } - Student struct { Group func(childComplexity int) int Mtknr func(childComplexity int) int @@ -537,6 +528,7 @@ type ComplexityRoot struct { FK func(childComplexity int) int Fullname func(childComplexity int) int ID func(childComplexity int) int + IsActive func(childComplexity int) int IsLBA func(childComplexity int) int IsProf func(childComplexity int) int IsProfHC func(childComplexity int) int @@ -677,8 +669,6 @@ type QueryResolver interface { StudentByMtknr(ctx context.Context, mtknr string) (*model.Student, error) StudentsByName(ctx context.Context, regex string) ([]*model.Student, error) Students(ctx context.Context) ([]*model.Student, error) - Workflow(ctx context.Context) ([]*model.Step, error) - NextDeadline(ctx context.Context) (*model.Step, error) Teacher(ctx context.Context, id int) (*model.Teacher, error) Teachers(ctx context.Context, fromZpa *bool) ([]*model.Teacher, error) Invigilators(ctx context.Context) ([]*model.ZPAInvigilator, error) @@ -2343,13 +2333,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.MucdaiExams(childComplexity), true - case "Query.nextDeadline": - if e.complexity.Query.NextDeadline == nil { - break - } - - return e.complexity.Query.NextDeadline(childComplexity), true - case "Query.nta": if e.complexity.Query.Nta == nil { break @@ -2602,13 +2585,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.Teachers(childComplexity, args["fromZPA"].(*bool)), true - case "Query.workflow": - if e.complexity.Query.Workflow == nil { - break - } - - return e.complexity.Query.Workflow(childComplexity), true - case "Query.zpaAnCodes": if e.complexity.Query.ZpaAnCodes == nil { break @@ -2990,34 +2966,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Starttime.Start(childComplexity), true - case "Step.deadline": - if e.complexity.Step.Deadline == nil { - break - } - - return e.complexity.Step.Deadline(childComplexity), true - - case "Step.done": - if e.complexity.Step.Done == nil { - break - } - - return e.complexity.Step.Done(childComplexity), true - - case "Step.name": - if e.complexity.Step.Name == nil { - break - } - - return e.complexity.Step.Name(childComplexity), true - - case "Step.number": - if e.complexity.Step.Number == nil { - break - } - - return e.complexity.Step.Number(childComplexity), true - case "Student.group": if e.complexity.Student.Group == nil { break @@ -3179,6 +3127,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Teacher.ID(childComplexity), true + case "Teacher.isActive": + if e.complexity.Teacher.IsActive == nil { + break + } + + return e.complexity.Teacher.IsActive(childComplexity), true + case "Teacher.isLBA": if e.complexity.Teacher.IsLBA == nil { break @@ -3553,7 +3508,9 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../constraints.graphqls", Input: `extend type Query { + {Name: "../constraints.graphqls", Input: `scalar Time + +extend type Query { constraintForAncode(ancode: Int!): Constraints zpaExamsToPlanWithConstraints: [ZPAExamWithConstraints!]! } @@ -4092,20 +4049,6 @@ type Student { regs: [Int!]! nta: NTA } -`, BuiltIn: false}, - {Name: "../workflow.graphqls", Input: `scalar Time - -extend type Query { - workflow: [Step!]! - nextDeadline: Step -} - -type Step { - number: Int! - name: String! - done: Boolean! - deadline: Time -} `, BuiltIn: false}, {Name: "../zpa.graphqls", Input: `extend type Query { teacher(id: Int!): Teacher @@ -4193,6 +4136,7 @@ type Teacher { fk: String! id: Int! email: String! + isActive: Boolean! } `, BuiltIn: false}, } @@ -8198,6 +8142,8 @@ func (ec *executionContext) fieldContext_GeneratedExam_mainExamer(_ context.Cont return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -8857,6 +8803,8 @@ func (ec *executionContext) fieldContext_InvigilationSlot_reserve(_ context.Cont return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -9339,6 +9287,8 @@ func (ec *executionContext) fieldContext_Invigilator_teacher(_ context.Context, return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -12930,6 +12880,8 @@ func (ec *executionContext) fieldContext_NTAWithRegsByExamAndTeacher_teacher(_ c return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -13377,6 +13329,8 @@ func (ec *executionContext) fieldContext_PlannedExam_mainExamer(_ context.Contex return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -18032,111 +17986,6 @@ func (ec *executionContext) fieldContext_Query_students(_ context.Context, field return fc, nil } -func (ec *executionContext) _Query_workflow(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_workflow(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Workflow(rctx) - }) - 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.Step) - fc.Result = res - return ec.marshalNStep2ᚕᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStepᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_workflow(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "number": - return ec.fieldContext_Step_number(ctx, field) - case "name": - return ec.fieldContext_Step_name(ctx, field) - case "done": - return ec.fieldContext_Step_done(ctx, field) - case "deadline": - return ec.fieldContext_Step_deadline(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Step", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _Query_nextDeadline(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_nextDeadline(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().NextDeadline(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.Step) - fc.Result = res - return ec.marshalOStep2ᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStep(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_nextDeadline(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "number": - return ec.fieldContext_Step_number(ctx, field) - case "name": - return ec.fieldContext_Step_name(ctx, field) - case "done": - return ec.fieldContext_Step_done(ctx, field) - case "deadline": - return ec.fieldContext_Step_deadline(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Step", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _Query_teacher(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_teacher(ctx, field) if err != nil { @@ -18193,6 +18042,8 @@ func (ec *executionContext) fieldContext_Query_teacher(ctx context.Context, fiel return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -18270,6 +18121,8 @@ func (ec *executionContext) fieldContext_Query_teachers(ctx context.Context, fie return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -20207,6 +20060,8 @@ func (ec *executionContext) fieldContext_RoomWithInvigilator_invigilator(_ conte return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -21152,179 +21007,6 @@ func (ec *executionContext) fieldContext_Starttime_start(_ context.Context, fiel return fc, nil } -func (ec *executionContext) _Step_number(ctx context.Context, field graphql.CollectedField, obj *model.Step) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Step_number(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Number, 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.(int) - fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Step_number(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Step", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Step_name(ctx context.Context, field graphql.CollectedField, obj *model.Step) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Step_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, 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) fieldContext_Step_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Step", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Step_done(ctx context.Context, field graphql.CollectedField, obj *model.Step) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Step_done(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Done, 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.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Step_done(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Step", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Step_deadline(ctx context.Context, field graphql.CollectedField, obj *model.Step) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Step_deadline(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { - ctx = rctx // use context from middleware stack in children - return obj.Deadline, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(time.Time) - fc.Result = res - return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Step_deadline(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Step", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Student_mtknr(ctx context.Context, field graphql.CollectedField, obj *model.Student) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Student_mtknr(ctx, field) if err != nil { @@ -22662,6 +22344,50 @@ func (ec *executionContext) fieldContext_Teacher_email(_ context.Context, field return fc, nil } +func (ec *executionContext) _Teacher_isActive(ctx context.Context, field graphql.CollectedField, obj *model.Teacher) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Teacher_isActive(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsActive, 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.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Teacher_isActive(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Teacher", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _ZPAConflict_ancode(ctx context.Context, field graphql.CollectedField, obj *model.ZPAConflict) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ZPAConflict_ancode(ctx, field) if err != nil { @@ -23693,6 +23419,8 @@ func (ec *executionContext) fieldContext_ZPAInvigilator_teacher(_ context.Contex return ec.fieldContext_Teacher_id(ctx, field) case "email": return ec.fieldContext_Teacher_email(ctx, field) + case "isActive": + return ec.fieldContext_Teacher_isActive(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Teacher", field.Name) }, @@ -29574,47 +29302,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "workflow": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_workflow(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "nextDeadline": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_nextDeadline(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "teacher": field := field @@ -30477,57 +30164,6 @@ func (ec *executionContext) _Starttime(ctx context.Context, sel ast.SelectionSet return out } -var stepImplementors = []string{"Step"} - -func (ec *executionContext) _Step(ctx context.Context, sel ast.SelectionSet, obj *model.Step) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, stepImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Step") - case "number": - out.Values[i] = ec._Step_number(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._Step_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "done": - out.Values[i] = ec._Step_done(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deadline": - out.Values[i] = ec._Step_deadline(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var studentImplementors = []string{"Student"} func (ec *executionContext) _Student(ctx context.Context, sel ast.SelectionSet, obj *model.Student) graphql.Marshaler { @@ -30851,6 +30487,11 @@ func (ec *executionContext) _Teacher(ctx context.Context, sel ast.SelectionSet, if out.Values[i] == graphql.Null { out.Invalids++ } + case "isActive": + out.Values[i] = ec._Teacher_isActive(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -33069,60 +32710,6 @@ func (ec *executionContext) marshalNStarttime2ᚖgithubᚗcomᚋobcodeᚋplexams return ec._Starttime(ctx, sel, v) } -func (ec *executionContext) marshalNStep2ᚕᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStepᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Step) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNStep2ᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStep(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNStep2ᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStep(ctx context.Context, sel ast.SelectionSet, v *model.Step) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._Step(ctx, sel, v) -} - func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -34886,13 +34473,6 @@ func (ec *executionContext) marshalOSlot2ᚕᚖgithubᚗcomᚋobcodeᚋplexams return ret } -func (ec *executionContext) marshalOStep2ᚖgithubᚗcomᚋobcodeᚋplexamsᚗgoᚋgraphᚋmodelᚐStep(ctx context.Context, sel ast.SelectionSet, v *model.Step) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._Step(ctx, sel, v) -} - func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { if v == nil { return nil, nil @@ -35062,18 +34642,6 @@ func (ec *executionContext) marshalOTeacher2ᚖgithubᚗcomᚋobcodeᚋplexams return ec._Teacher(ctx, sel, v) } -func (ec *executionContext) unmarshalOTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) { - res, err := graphql.UnmarshalTime(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { - _ = sel - _ = ctx - res := graphql.MarshalTime(v) - return res -} - func (ec *executionContext) unmarshalOTime2ᚕᚖtimeᚐTimeᚄ(ctx context.Context, v any) ([]*time.Time, error) { if v == nil { return nil, nil diff --git a/graph/invigilation.resolvers.go b/graph/invigilation.resolvers.go index 7c465ab..5b7419d 100644 --- a/graph/invigilation.resolvers.go +++ b/graph/invigilation.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/nta.resolvers.go b/graph/nta.resolvers.go index 2323337..3a32798 100644 --- a/graph/nta.resolvers.go +++ b/graph/nta.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/plan.resolvers.go b/graph/plan.resolvers.go index 10ab3a6..57f5a54 100644 --- a/graph/plan.resolvers.go +++ b/graph/plan.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/primuss.resolvers.go b/graph/primuss.resolvers.go index 913d63c..4eb0f29 100644 --- a/graph/primuss.resolvers.go +++ b/graph/primuss.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/room.resolvers.go b/graph/room.resolvers.go index 66ae571..b5a5acb 100644 --- a/graph/room.resolvers.go +++ b/graph/room.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/semesterconfig.resolvers.go b/graph/semesterconfig.resolvers.go index e20b922..4193a2f 100644 --- a/graph/semesterconfig.resolvers.go +++ b/graph/semesterconfig.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/studentregs.resolvers.go b/graph/studentregs.resolvers.go index efad936..fbb6bca 100644 --- a/graph/studentregs.resolvers.go +++ b/graph/studentregs.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/graph/workflow.graphqls b/graph/workflow.graphqls deleted file mode 100644 index 34c1609..0000000 --- a/graph/workflow.graphqls +++ /dev/null @@ -1,13 +0,0 @@ -scalar Time - -extend type Query { - workflow: [Step!]! - nextDeadline: Step -} - -type Step { - number: Int! - name: String! - done: Boolean! - deadline: Time -} diff --git a/graph/workflow.resolvers.go b/graph/workflow.resolvers.go deleted file mode 100644 index 35ab8cd..0000000 --- a/graph/workflow.resolvers.go +++ /dev/null @@ -1,21 +0,0 @@ -package graph - -// This file will be automatically regenerated based on the schema, any resolver implementations -// will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 - -import ( - "context" - - "github.com/obcode/plexams.go/graph/model" -) - -// Workflow is the resolver for the workflow field. -func (r *queryResolver) Workflow(ctx context.Context) ([]*model.Step, error) { - return r.plexams.GetWorkflow(ctx) -} - -// NextDeadline is the resolver for the nextDeadline field. -func (r *queryResolver) NextDeadline(ctx context.Context) (*model.Step, error) { - return r.plexams.NextDeadline(ctx) -} diff --git a/graph/zpa.resolvers.go b/graph/zpa.resolvers.go index 7924ed0..8caa6c1 100644 --- a/graph/zpa.resolvers.go +++ b/graph/zpa.resolvers.go @@ -2,7 +2,7 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.75 +// Code generated by github.com/99designs/gqlgen version v0.17.76 import ( "context" diff --git a/plexams/plexams.go b/plexams/plexams.go index 9a4aaa6..1c622c3 100644 --- a/plexams/plexams.go +++ b/plexams/plexams.go @@ -19,7 +19,6 @@ type Plexams struct { semester string dbClient *db.DB zpa *ZPA - workflow []*model.Step planer *Planer email *Email semesterConfig *model.SemesterConfig @@ -78,7 +77,6 @@ func NewPlexams(semester, dbUri, zpaBaseurl, zpaUsername, zpaPassword string, fk password: zpaPassword, fk07programs: fk07programs, }, - workflow: initWorkflow(), planer: &Planer{ Name: viper.GetString("planer.name"), Email: viper.GetString("planer.email"), diff --git a/plexams/workflow.go b/plexams/workflow.go deleted file mode 100644 index 655f6fe..0000000 --- a/plexams/workflow.go +++ /dev/null @@ -1,52 +0,0 @@ -package plexams - -import ( - "context" - - "github.com/gookit/color" - "github.com/obcode/plexams.go/graph/model" - "github.com/rs/zerolog/log" - "github.com/spf13/viper" -) - -func initWorkflow() []*model.Step { - var workflow []*model.Step - err := viper.UnmarshalKey("workflow", &workflow) - if err != nil { - log.Fatal().Err(err).Msg("cannot decode workflow with viper") - } - - for i, s := range workflow { - s.Number = i + 1 - } - - return workflow -} - -func (p *Plexams) GetWorkflow(ctx context.Context) ([]*model.Step, error) { - return p.workflow, nil -} - -func (p *Plexams) NextDeadline(ctx context.Context) (*model.Step, error) { - for _, step := range p.workflow { - if !step.Done && step.Deadline.Unix() > 0 { - return step, nil - } - } - - return nil, nil -} - -func (p *Plexams) PrintWorkflow() { - for _, step := range p.workflow { - if step.Done { - color.Green.Printf("%2d. %s", step.Number, step.Name) - } else { - color.Red.Printf("%2d. %s", step.Number, step.Name) - if step.Deadline.Unix() > 0 { - color.Yellow.Printf(" (Deadline %s)", step.Deadline.Format("02.01.06")) - } - } - color.Println() - } -}