Add name and description for task
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
@@ -135,6 +135,7 @@ type TaskEdge {
|
||||
type Task implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
description: String!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
@@ -130,10 +130,11 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
Task struct {
|
||||
CreatedAt func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
CreatedAt func(childComplexity int) int
|
||||
Description func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
}
|
||||
|
||||
TaskConnection struct {
|
||||
@@ -506,6 +507,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Task.CreatedAt(childComplexity), true
|
||||
|
||||
case "Task.description":
|
||||
if e.complexity.Task.Description == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Task.Description(childComplexity), true
|
||||
|
||||
case "Task.id":
|
||||
if e.complexity.Task.ID == nil {
|
||||
break
|
||||
@@ -781,6 +789,7 @@ type TaskEdge {
|
||||
type Task implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
description: String!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
@@ -3118,6 +3127,44 @@ func (ec *executionContext) fieldContext_Task_name(_ context.Context, field grap
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Task_description(ctx context.Context, field graphql.CollectedField, obj *types.Task) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Task_description(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.Description, 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_Task_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Task",
|
||||
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) _Task_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.Task) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Task_createdAt(ctx, field)
|
||||
if err != nil {
|
||||
@@ -3361,6 +3408,8 @@ func (ec *executionContext) fieldContext_TaskEdge_node(_ context.Context, field
|
||||
return ec.fieldContext_Task_id(ctx, field)
|
||||
case "name":
|
||||
return ec.fieldContext_Task_name(ctx, field)
|
||||
case "description":
|
||||
return ec.fieldContext_Task_description(ctx, field)
|
||||
case "createdAt":
|
||||
return ec.fieldContext_Task_createdAt(ctx, field)
|
||||
case "updatedAt":
|
||||
@@ -5727,6 +5776,11 @@ func (ec *executionContext) _Task(ctx context.Context, sel ast.SelectionSet, obj
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "description":
|
||||
out.Values[i] = ec._Task_description(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Task_createdAt(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
|
||||
@@ -41,8 +41,10 @@ func NewTaskEdge(t *coredata.Task) *TaskEdge {
|
||||
|
||||
func NewTask(t *coredata.Task) *Task {
|
||||
return &Task{
|
||||
ID: t.ID,
|
||||
CreatedAt: t.CreatedAt,
|
||||
UpdatedAt: t.UpdatedAt,
|
||||
ID: t.ID,
|
||||
Name: t.Name,
|
||||
Description: t.Description,
|
||||
CreatedAt: t.CreatedAt,
|
||||
UpdatedAt: t.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +104,11 @@ type Query struct {
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Task) IsNode() {}
|
||||
|
||||
@@ -30,11 +30,13 @@ import (
|
||||
|
||||
type (
|
||||
Task struct {
|
||||
ID gid.GID
|
||||
ControlID gid.GID
|
||||
ContentRef string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
ID gid.GID
|
||||
ControlID gid.GID
|
||||
Name string
|
||||
Description string
|
||||
ContentRef string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
Tasks []*Task
|
||||
@@ -48,6 +50,8 @@ func (t *Task) scan(r pgx.Row) error {
|
||||
return r.Scan(
|
||||
&t.ID,
|
||||
&t.ControlID,
|
||||
&t.Name,
|
||||
&t.Description,
|
||||
&t.ContentRef,
|
||||
&t.CreatedAt,
|
||||
&t.UpdatedAt,
|
||||
@@ -66,6 +70,8 @@ WITH control_tasks AS (
|
||||
SELECT
|
||||
t.id,
|
||||
@control_id AS control_id,
|
||||
t.name,
|
||||
t.description,
|
||||
t.content_ref,
|
||||
t.created_at,
|
||||
t.updated_at
|
||||
@@ -81,6 +87,8 @@ WITH control_tasks AS (
|
||||
SELECT
|
||||
id,
|
||||
control_id,
|
||||
name,
|
||||
description,
|
||||
content_ref,
|
||||
created_at,
|
||||
updated_at
|
||||
|
||||
Reference in New Issue
Block a user