@@ -10,6 +10,7 @@ LDFLAGS= -ldflags "-X 'main.version=$(VERSION)' -X 'main.env=prod'"
|
||||
GCFLAGS= -gcflags="-e"
|
||||
|
||||
GO_BUILD= CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) $(GO) build $(LDFLAGS) $(GCFLAGS)
|
||||
GO_GENERATE= $(GO) generate
|
||||
|
||||
CONTROL_SRC:= $(shell find ./controls -type f -name "*.md")
|
||||
|
||||
@@ -30,9 +31,14 @@ vet:
|
||||
build: bin/probod
|
||||
|
||||
.PHONY: bin/probod
|
||||
bin/probod:
|
||||
bin/probod: pkg/api/console/v1/schema/schema.go pkg/api/console/v1/types/types.go pkg/api/console/v1/v1_resolver.go
|
||||
$(GO_BUILD) -o $(PROBOD_BIN) $(PROBOD_SRC)
|
||||
|
||||
pkg/api/console/v1/schema/schema.go \
|
||||
pkg/api/console/v1/types/types.go \
|
||||
pkg/api/console/v1/v1_resolver.go: pkg/api/console/v1/gqlgen.yaml pkg/api/console/v1/schema.graphql
|
||||
$(GO_GENERATE) ./pkg/api/console/v1
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
$(PRETTIER) --write --prose-wrap always $(CONTROL_SRC)
|
||||
|
||||
24
pkg/api/console/v1/gqlgen.yaml
Normal file
24
pkg/api/console/v1/gqlgen.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
schema: ["schema.graphql"]
|
||||
|
||||
exec:
|
||||
filename: "schema/schema.go"
|
||||
package: "schema"
|
||||
|
||||
model:
|
||||
filename: "types/types.go"
|
||||
package: "types"
|
||||
|
||||
resolver:
|
||||
layout: "follow-schema"
|
||||
dir: "."
|
||||
package: "console_v1"
|
||||
filename_template: "v1_resolver.go"
|
||||
|
||||
autobind: []
|
||||
omit_panic_handler: true
|
||||
call_argument_directives_with_null: true
|
||||
|
||||
models:
|
||||
Datetime:
|
||||
model:
|
||||
- "github.com/99designs/gqlgen/graphql.Time"
|
||||
7
pkg/api/console/v1/resolver.go
Normal file
7
pkg/api/console/v1/resolver.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:generate go run github.com/99designs/gqlgen generate
|
||||
|
||||
package console_v1
|
||||
|
||||
type (
|
||||
Resolver struct{}
|
||||
)
|
||||
108
pkg/api/console/v1/schema.graphql
Normal file
108
pkg/api/console/v1/schema.graphql
Normal file
@@ -0,0 +1,108 @@
|
||||
directive @goField(
|
||||
forceResolver: Boolean
|
||||
name: String
|
||||
omittable: Boolean
|
||||
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
||||
|
||||
scalar CursorKey
|
||||
scalar Void
|
||||
scalar Datetime
|
||||
|
||||
interface Node {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
hasNextPage: Boolean!
|
||||
hasPreviousPage: Boolean!
|
||||
startCursor: CursorKey
|
||||
endCursor: CursorKey
|
||||
}
|
||||
|
||||
type Organization implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
|
||||
frameworks(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
): FrameworkConnection! @goField(forceResolver: true)
|
||||
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type FrameworkConnection {
|
||||
edges: [FrameworkEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type FrameworkEdge {
|
||||
cursor: CursorKey!
|
||||
node: Framework!
|
||||
}
|
||||
|
||||
type Framework implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
description: String!
|
||||
|
||||
controls(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
): ControlConnection! @goField(forceResolver: true)
|
||||
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type ControlConnection {
|
||||
edges: [ControlEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type ControlEdge {
|
||||
cursor: CursorKey!
|
||||
node: Control!
|
||||
}
|
||||
|
||||
type Control implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
description: String!
|
||||
|
||||
tasks(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
): TaskConnection! @goField(forceResolver: true)
|
||||
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type TaskConnection {
|
||||
edges: [TaskEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type TaskEdge {
|
||||
cursor: CursorKey!
|
||||
node: Task!
|
||||
}
|
||||
|
||||
type Task implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type Query {
|
||||
node(id: ID!): Node!
|
||||
}
|
||||
6066
pkg/api/console/v1/schema/schema.go
Normal file
6066
pkg/api/console/v1/schema/schema.go
Normal file
File diff suppressed because it is too large
Load Diff
97
pkg/api/console/v1/types/types.go
Normal file
97
pkg/api/console/v1/types/types.go
Normal file
@@ -0,0 +1,97 @@
|
||||
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Node interface {
|
||||
IsNode()
|
||||
GetID() string
|
||||
}
|
||||
|
||||
type Control struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Tasks *TaskConnection `json:"tasks"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Control) IsNode() {}
|
||||
func (this Control) GetID() string { return this.ID }
|
||||
|
||||
type ControlConnection struct {
|
||||
Edges []*ControlEdge `json:"edges"`
|
||||
PageInfo *PageInfo `json:"pageInfo"`
|
||||
}
|
||||
|
||||
type ControlEdge struct {
|
||||
Cursor string `json:"cursor"`
|
||||
Node *Control `json:"node"`
|
||||
}
|
||||
|
||||
type Framework struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Framework) IsNode() {}
|
||||
func (this Framework) GetID() string { return this.ID }
|
||||
|
||||
type FrameworkConnection struct {
|
||||
Edges []*FrameworkEdge `json:"edges"`
|
||||
PageInfo *PageInfo `json:"pageInfo"`
|
||||
}
|
||||
|
||||
type FrameworkEdge struct {
|
||||
Cursor string `json:"cursor"`
|
||||
Node *Framework `json:"node"`
|
||||
}
|
||||
|
||||
type Organization struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Frameworks *FrameworkConnection `json:"frameworks"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Organization) IsNode() {}
|
||||
func (this Organization) GetID() string { return this.ID }
|
||||
|
||||
type PageInfo struct {
|
||||
HasNextPage bool `json:"hasNextPage"`
|
||||
HasPreviousPage bool `json:"hasPreviousPage"`
|
||||
StartCursor *string `json:"startCursor,omitempty"`
|
||||
EndCursor *string `json:"endCursor,omitempty"`
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Task) IsNode() {}
|
||||
func (this Task) GetID() string { return this.ID }
|
||||
|
||||
type TaskConnection struct {
|
||||
Edges []*TaskEdge `json:"edges"`
|
||||
PageInfo *PageInfo `json:"pageInfo"`
|
||||
}
|
||||
|
||||
type TaskEdge struct {
|
||||
Cursor string `json:"cursor"`
|
||||
Node *Task `json:"node"`
|
||||
}
|
||||
50
pkg/api/console/v1/v1_resolver.go
Normal file
50
pkg/api/console/v1/v1_resolver.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package console_v1
|
||||
|
||||
// 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.63
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/getprobo/probo/pkg/api/console/v1/schema"
|
||||
"github.com/getprobo/probo/pkg/api/console/v1/types"
|
||||
)
|
||||
|
||||
// Tasks is the resolver for the tasks field.
|
||||
func (r *controlResolver) Tasks(ctx context.Context, obj *types.Control, first *int, after *string, last *int, before *string) (*types.TaskConnection, error) {
|
||||
panic(fmt.Errorf("not implemented: Tasks - tasks"))
|
||||
}
|
||||
|
||||
// Controls is the resolver for the controls field.
|
||||
func (r *frameworkResolver) Controls(ctx context.Context, obj *types.Framework, first *int, after *string, last *int, before *string) (*types.ControlConnection, error) {
|
||||
panic(fmt.Errorf("not implemented: Controls - controls"))
|
||||
}
|
||||
|
||||
// Frameworks is the resolver for the frameworks field.
|
||||
func (r *organizationResolver) Frameworks(ctx context.Context, obj *types.Organization, first *int, after *string, last *int, before *string) (*types.FrameworkConnection, error) {
|
||||
panic(fmt.Errorf("not implemented: Frameworks - frameworks"))
|
||||
}
|
||||
|
||||
// Node is the resolver for the node field.
|
||||
func (r *queryResolver) Node(ctx context.Context, id string) (types.Node, error) {
|
||||
panic(fmt.Errorf("not implemented: Node - node"))
|
||||
}
|
||||
|
||||
// Control returns schema.ControlResolver implementation.
|
||||
func (r *Resolver) Control() schema.ControlResolver { return &controlResolver{r} }
|
||||
|
||||
// Framework returns schema.FrameworkResolver implementation.
|
||||
func (r *Resolver) Framework() schema.FrameworkResolver { return &frameworkResolver{r} }
|
||||
|
||||
// Organization returns schema.OrganizationResolver implementation.
|
||||
func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} }
|
||||
|
||||
// Query returns schema.QueryResolver implementation.
|
||||
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
|
||||
|
||||
type controlResolver struct{ *Resolver }
|
||||
type frameworkResolver struct{ *Resolver }
|
||||
type organizationResolver struct{ *Resolver }
|
||||
type queryResolver struct{ *Resolver }
|
||||
Reference in New Issue
Block a user