diff --git a/.gitignore b/.gitignore index 84b03c9..d2fdff5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .keto/roles/admin.json .keto/roles/user.json .oathkeeper/jwks.json +./bin/** diff --git a/Makefile b/Makefile index 273fbbf..7191d48 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,8 @@ build: go build -o bin/main main.go run: - go run main.go \ No newline at end of file + go run main.go + +buildweb: + cd web/ + yarn run build \ No newline at end of file diff --git a/changelog.md b/changelog.md index 3f82a30..e3c6879 100644 --- a/changelog.md +++ b/changelog.md @@ -3,3 +3,7 @@ ## 09/02/2021 `v0.1.0` - Initial Commit for web app + +## 10/02/2021 `v0.1.1` + +- GraphQL support added! diff --git a/go.mod b/go.mod index c50b2c7..355f6d2 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module anc +module github.com/Mshivam2409/AnC-Courses go 1.13 @@ -6,7 +6,6 @@ require ( github.com/99designs/gqlgen v0.13.0 github.com/andybalholm/brotli v1.0.1 // indirect github.com/ansrivas/fiberprometheus/v2 v2.1.0 - github.com/aws/aws-sdk-go v1.34.28 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/go-openapi/errors v0.19.8 // indirect github.com/go-openapi/runtime v0.19.23 // indirect diff --git a/gqlgen.yml b/gqlgen.yml index 922d1ef..f189a4f 100644 --- a/gqlgen.yml +++ b/gqlgen.yml @@ -35,7 +35,7 @@ resolver: # gqlgen will search for any type names in the schema in these go packages # if they match it will use them, otherwise it will generate them. autobind: - - "anc/graph/model" + - "github.com/Mshivam2409/AnC-Courses/graph/model" # This section declares type mapping between the GraphQL and go type systems # diff --git a/graph/generated/generated.go b/graph/generated/generated.go index 562eeee..4272184 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -3,7 +3,6 @@ package generated import ( - "anc/graph/model" "bytes" "context" "errors" @@ -13,6 +12,7 @@ import ( "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" + "github.com/Mshivam2409/AnC-Courses/graph/model" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" ) @@ -252,7 +252,7 @@ func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, var arg0 model.NewTodo if tmp, ok := rawArgs["input"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - arg0, err = ec.unmarshalNNewTodo2ancᚋgraphᚋmodelᚐNewTodo(ctx, tmp) + arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐNewTodo(ctx, tmp) if err != nil { return nil, err } @@ -353,7 +353,7 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap } res := resTmp.(*model.Todo) fc.Result = res - return ec.marshalNTodo2ᚖancᚋgraphᚋmodelᚐTodo(ctx, field.Selections, res) + return ec.marshalNTodo2ᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -388,7 +388,7 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll } res := resTmp.([]*model.Todo) fc.Result = res - return ec.marshalNTodo2ᚕᚖancᚋgraphᚋmodelᚐTodoᚄ(ctx, field.Selections, res) + return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodoᚄ(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -599,7 +599,7 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec } res := resTmp.(*model.User) fc.Result = res - return ec.marshalNUser2ᚖancᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) + return ec.marshalNUser2ᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { @@ -2219,7 +2219,7 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec return res } -func (ec *executionContext) unmarshalNNewTodo2ancᚋgraphᚋmodelᚐNewTodo(ctx context.Context, v interface{}) (model.NewTodo, error) { +func (ec *executionContext) unmarshalNNewTodo2githubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐNewTodo(ctx context.Context, v interface{}) (model.NewTodo, error) { res, err := ec.unmarshalInputNewTodo(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } @@ -2239,11 +2239,11 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S return res } -func (ec *executionContext) marshalNTodo2ancᚋgraphᚋmodelᚐTodo(ctx context.Context, sel ast.SelectionSet, v model.Todo) graphql.Marshaler { +func (ec *executionContext) marshalNTodo2githubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodo(ctx context.Context, sel ast.SelectionSet, v model.Todo) graphql.Marshaler { return ec._Todo(ctx, sel, &v) } -func (ec *executionContext) marshalNTodo2ᚕᚖancᚋgraphᚋmodelᚐTodoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Todo) graphql.Marshaler { +func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodoᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Todo) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -2267,7 +2267,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖancᚋgraphᚋmodelᚐTodoᚄ(ctx if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNTodo2ᚖancᚋgraphᚋmodelᚐTodo(ctx, sel, v[i]) + ret[i] = ec.marshalNTodo2ᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodo(ctx, sel, v[i]) } if isLen1 { f(i) @@ -2280,7 +2280,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖancᚋgraphᚋmodelᚐTodoᚄ(ctx return ret } -func (ec *executionContext) marshalNTodo2ᚖancᚋgraphᚋmodelᚐTodo(ctx context.Context, sel ast.SelectionSet, v *model.Todo) graphql.Marshaler { +func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐTodo(ctx context.Context, sel ast.SelectionSet, v *model.Todo) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") @@ -2290,7 +2290,7 @@ func (ec *executionContext) marshalNTodo2ᚖancᚋgraphᚋmodelᚐTodo(ctx conte return ec._Todo(ctx, sel, v) } -func (ec *executionContext) marshalNUser2ᚖancᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { +func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋMshivam2409ᚋAnCᚑCoursesᚋgraphᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") diff --git a/graph/schema.resolvers.go b/graph/schema.resolvers.go index ecdc63d..cf1c571 100644 --- a/graph/schema.resolvers.go +++ b/graph/schema.resolvers.go @@ -4,10 +4,11 @@ package graph // will be copied through when generating and any unknown code will be moved to the end. import ( - "anc/graph/generated" - "anc/graph/model" "context" "fmt" + + "github.com/Mshivam2409/AnC-Courses/graph/generated" + "github.com/Mshivam2409/AnC-Courses/graph/model" ) func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) { diff --git a/main.go b/main.go index de7de84..7d30ff4 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,10 @@ package main import ( - "anc/graph/generated" "net/http" + "github.com/Mshivam2409/AnC-Courses/graph/generated" + "github.com/99designs/gqlgen/graphql/handler" "github.com/ansrivas/fiberprometheus/v2" "github.com/gofiber/fiber/v2" diff --git a/schema.example.graphql b/schema.example.graphql index c6a91bb..ea80cfa 100644 --- a/schema.example.graphql +++ b/schema.example.graphql @@ -26,3 +26,6 @@ input NewTodo { type Mutation { createTodo(input: NewTodo!): Todo! } + +type Course { +}