@@ -25,6 +25,12 @@ enum TaskState {
|
||||
DONE
|
||||
}
|
||||
|
||||
enum EvidenceState {
|
||||
VALID
|
||||
INVALID
|
||||
EXPIRED
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
hasNextPage: Boolean!
|
||||
hasPreviousPage: Boolean!
|
||||
@@ -242,6 +248,7 @@ type EvidenceEdge {
|
||||
type Evidence implements Node {
|
||||
id: ID!
|
||||
fileUrl: String!
|
||||
state: EvidenceState!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ type ComplexityRoot struct {
|
||||
CreatedAt func(childComplexity int) int
|
||||
FileURL func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
State func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
}
|
||||
|
||||
@@ -450,6 +451,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Evidence.ID(childComplexity), true
|
||||
|
||||
case "Evidence.state":
|
||||
if e.complexity.Evidence.State == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Evidence.State(childComplexity), true
|
||||
|
||||
case "Evidence.updatedAt":
|
||||
if e.complexity.Evidence.UpdatedAt == nil {
|
||||
break
|
||||
@@ -1070,6 +1078,12 @@ enum TaskState {
|
||||
DONE
|
||||
}
|
||||
|
||||
enum EvidenceState {
|
||||
VALID
|
||||
INVALID
|
||||
EXPIRED
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
hasNextPage: Boolean!
|
||||
hasPreviousPage: Boolean!
|
||||
@@ -1287,6 +1301,7 @@ type EvidenceEdge {
|
||||
type Evidence implements Node {
|
||||
id: ID!
|
||||
fileUrl: String!
|
||||
state: EvidenceState!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
@@ -3010,6 +3025,44 @@ func (ec *executionContext) fieldContext_Evidence_fileUrl(_ context.Context, fie
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Evidence_state(ctx context.Context, field graphql.CollectedField, obj *types.Evidence) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Evidence_state(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.State, 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.(types.EvidenceState)
|
||||
fc.Result = res
|
||||
return ec.marshalNEvidenceState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐEvidenceState(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Evidence_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Evidence",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type EvidenceState does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Evidence_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.Evidence) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Evidence_createdAt(ctx, field)
|
||||
if err != nil {
|
||||
@@ -3253,6 +3306,8 @@ func (ec *executionContext) fieldContext_EvidenceEdge_node(_ context.Context, fi
|
||||
return ec.fieldContext_Evidence_id(ctx, field)
|
||||
case "fileUrl":
|
||||
return ec.fieldContext_Evidence_fileUrl(ctx, field)
|
||||
case "state":
|
||||
return ec.fieldContext_Evidence_state(ctx, field)
|
||||
case "createdAt":
|
||||
return ec.fieldContext_Evidence_createdAt(ctx, field)
|
||||
case "updatedAt":
|
||||
@@ -7938,6 +7993,11 @@ func (ec *executionContext) _Evidence(ctx context.Context, sel ast.SelectionSet,
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "state":
|
||||
out.Values[i] = ec._Evidence_state(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Evidence_createdAt(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
@@ -9750,6 +9810,16 @@ func (ec *executionContext) marshalNEvidenceEdge2ᚖgithubᚗcomᚋgetproboᚋpr
|
||||
return ec._EvidenceEdge(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNEvidenceState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐEvidenceState(ctx context.Context, v any) (types.EvidenceState, error) {
|
||||
var res types.EvidenceState
|
||||
err := res.UnmarshalGQL(v)
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNEvidenceState2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐEvidenceState(ctx context.Context, sel ast.SelectionSet, v types.EvidenceState) graphql.Marshaler {
|
||||
return v
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐFramework(ctx context.Context, sel ast.SelectionSet, v *types.Framework) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
|
||||
@@ -39,11 +39,12 @@ func NewEvidenceEdge(e *coredata.Evidence) *EvidenceEdge {
|
||||
}
|
||||
}
|
||||
|
||||
func NewEvidence(c *coredata.Evidence) *Evidence {
|
||||
func NewEvidence(e *coredata.Evidence) *Evidence {
|
||||
return &Evidence{
|
||||
ID: c.ID,
|
||||
ID: e.ID,
|
||||
State: EvidenceState(e.State.String()),
|
||||
FileURL: "",
|
||||
CreatedAt: c.CreatedAt,
|
||||
UpdatedAt: c.UpdatedAt,
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,11 @@ type ControlStateTransitionEdge struct {
|
||||
}
|
||||
|
||||
type Evidence struct {
|
||||
ID gid.GID `json:"id"`
|
||||
FileURL string `json:"fileUrl"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
FileURL string `json:"fileUrl"`
|
||||
State EvidenceState `json:"state"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Evidence) IsNode() {}
|
||||
@@ -255,6 +256,49 @@ func (e ControlState) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
||||
|
||||
type EvidenceState string
|
||||
|
||||
const (
|
||||
EvidenceStateValid EvidenceState = "VALID"
|
||||
EvidenceStateInvalid EvidenceState = "INVALID"
|
||||
EvidenceStateExpired EvidenceState = "EXPIRED"
|
||||
)
|
||||
|
||||
var AllEvidenceState = []EvidenceState{
|
||||
EvidenceStateValid,
|
||||
EvidenceStateInvalid,
|
||||
EvidenceStateExpired,
|
||||
}
|
||||
|
||||
func (e EvidenceState) IsValid() bool {
|
||||
switch e {
|
||||
case EvidenceStateValid, EvidenceStateInvalid, EvidenceStateExpired:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e EvidenceState) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e *EvidenceState) UnmarshalGQL(v any) error {
|
||||
str, ok := v.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("enums must be strings")
|
||||
}
|
||||
|
||||
*e = EvidenceState(str)
|
||||
if !e.IsValid() {
|
||||
return fmt.Errorf("%s is not a valid EvidenceState", str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e EvidenceState) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
||||
|
||||
type TaskState string
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user