@@ -649,6 +649,7 @@ input CreatePolicyInput {
|
||||
name: String!
|
||||
content: String!
|
||||
status: PolicyStatus!
|
||||
reviewDate: Datetime
|
||||
}
|
||||
|
||||
input UpdatePolicyInput {
|
||||
@@ -657,6 +658,7 @@ input UpdatePolicyInput {
|
||||
name: String
|
||||
content: String
|
||||
status: PolicyStatus
|
||||
reviewDate: Datetime
|
||||
}
|
||||
|
||||
input DeletePolicyInput {
|
||||
@@ -681,6 +683,7 @@ type Policy implements Node {
|
||||
name: String!
|
||||
status: PolicyStatus!
|
||||
content: String!
|
||||
reviewDate: Datetime
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
@@ -285,13 +285,14 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
Policy struct {
|
||||
Content func(childComplexity int) int
|
||||
CreatedAt func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
Status func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
Version func(childComplexity int) int
|
||||
Content func(childComplexity int) int
|
||||
CreatedAt func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
ReviewDate func(childComplexity int) int
|
||||
Status func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
Version func(childComplexity int) int
|
||||
}
|
||||
|
||||
PolicyConnection struct {
|
||||
@@ -1497,6 +1498,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Policy.Name(childComplexity), true
|
||||
|
||||
case "Policy.reviewDate":
|
||||
if e.complexity.Policy.ReviewDate == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Policy.ReviewDate(childComplexity), true
|
||||
|
||||
case "Policy.status":
|
||||
if e.complexity.Policy.Status == nil {
|
||||
break
|
||||
@@ -2734,6 +2742,7 @@ input CreatePolicyInput {
|
||||
name: String!
|
||||
content: String!
|
||||
status: PolicyStatus!
|
||||
reviewDate: Datetime
|
||||
}
|
||||
|
||||
input UpdatePolicyInput {
|
||||
@@ -2742,6 +2751,7 @@ input UpdatePolicyInput {
|
||||
name: String
|
||||
content: String
|
||||
status: PolicyStatus
|
||||
reviewDate: Datetime
|
||||
}
|
||||
|
||||
input DeletePolicyInput {
|
||||
@@ -2766,6 +2776,7 @@ type Policy implements Node {
|
||||
name: String!
|
||||
status: PolicyStatus!
|
||||
content: String!
|
||||
reviewDate: Datetime
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
@@ -9472,6 +9483,41 @@ func (ec *executionContext) fieldContext_Policy_content(_ context.Context, field
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Policy_reviewDate(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Policy_reviewDate(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.ReviewDate, 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.marshalODatetime2ᚖtimeᚐTime(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Policy_reviewDate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Policy",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type Datetime does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Policy_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.Policy) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Policy_createdAt(ctx, field)
|
||||
if err != nil {
|
||||
@@ -9721,6 +9767,8 @@ func (ec *executionContext) fieldContext_PolicyEdge_node(_ context.Context, fiel
|
||||
return ec.fieldContext_Policy_status(ctx, field)
|
||||
case "content":
|
||||
return ec.fieldContext_Policy_content(ctx, field)
|
||||
case "reviewDate":
|
||||
return ec.fieldContext_Policy_reviewDate(ctx, field)
|
||||
case "createdAt":
|
||||
return ec.fieldContext_Policy_createdAt(ctx, field)
|
||||
case "updatedAt":
|
||||
@@ -11143,6 +11191,8 @@ func (ec *executionContext) fieldContext_UpdatePolicyPayload_policy(_ context.Co
|
||||
return ec.fieldContext_Policy_status(ctx, field)
|
||||
case "content":
|
||||
return ec.fieldContext_Policy_content(ctx, field)
|
||||
case "reviewDate":
|
||||
return ec.fieldContext_Policy_reviewDate(ctx, field)
|
||||
case "createdAt":
|
||||
return ec.fieldContext_Policy_createdAt(ctx, field)
|
||||
case "updatedAt":
|
||||
@@ -13966,7 +14016,7 @@ func (ec *executionContext) unmarshalInputCreatePolicyInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "content", "status"}
|
||||
fieldsInOrder := [...]string{"organizationId", "name", "content", "status", "reviewDate"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -14001,6 +14051,13 @@ func (ec *executionContext) unmarshalInputCreatePolicyInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Status = data
|
||||
case "reviewDate":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reviewDate"))
|
||||
data, err := ec.unmarshalODatetime2ᚖtimeᚐTime(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.ReviewDate = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14479,7 +14536,7 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"id", "expectedVersion", "name", "content", "status"}
|
||||
fieldsInOrder := [...]string{"id", "expectedVersion", "name", "content", "status", "reviewDate"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -14521,6 +14578,13 @@ func (ec *executionContext) unmarshalInputUpdatePolicyInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Status = data
|
||||
case "reviewDate":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reviewDate"))
|
||||
data, err := ec.unmarshalODatetime2ᚖtimeᚐTime(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.ReviewDate = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16903,6 +16967,8 @@ func (ec *executionContext) _Policy(ctx context.Context, sel ast.SelectionSet, o
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "reviewDate":
|
||||
out.Values[i] = ec._Policy_reviewDate(ctx, field, obj)
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Policy_createdAt(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
|
||||
@@ -21,13 +21,14 @@ import (
|
||||
|
||||
func NewPolicy(policy *coredata.Policy) *Policy {
|
||||
return &Policy{
|
||||
ID: policy.ID,
|
||||
Version: policy.Version,
|
||||
Name: policy.Name,
|
||||
Content: policy.Content,
|
||||
CreatedAt: policy.CreatedAt,
|
||||
UpdatedAt: policy.UpdatedAt,
|
||||
Status: policy.Status,
|
||||
ID: policy.ID,
|
||||
Version: policy.Version,
|
||||
Name: policy.Name,
|
||||
Content: policy.Content,
|
||||
CreatedAt: policy.CreatedAt,
|
||||
UpdatedAt: policy.UpdatedAt,
|
||||
Status: policy.Status,
|
||||
ReviewDate: policy.ReviewDate,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ type CreatePolicyInput struct {
|
||||
Name string `json:"name"`
|
||||
Content string `json:"content"`
|
||||
Status coredata.PolicyStatus `json:"status"`
|
||||
ReviewDate *time.Time `json:"reviewDate,omitempty"`
|
||||
}
|
||||
|
||||
type CreatePolicyPayload struct {
|
||||
@@ -315,13 +316,14 @@ type PeopleEdge struct {
|
||||
}
|
||||
|
||||
type Policy struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Version int `json:"version"`
|
||||
Name string `json:"name"`
|
||||
Status coredata.PolicyStatus `json:"status"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
Version int `json:"version"`
|
||||
Name string `json:"name"`
|
||||
Status coredata.PolicyStatus `json:"status"`
|
||||
Content string `json:"content"`
|
||||
ReviewDate *time.Time `json:"reviewDate,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Policy) IsNode() {}
|
||||
@@ -431,6 +433,7 @@ type UpdatePolicyInput struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Content *string `json:"content,omitempty"`
|
||||
Status *coredata.PolicyStatus `json:"status,omitempty"`
|
||||
ReviewDate *time.Time `json:"reviewDate,omitempty"`
|
||||
}
|
||||
|
||||
type UpdatePolicyPayload struct {
|
||||
|
||||
@@ -382,6 +382,7 @@ func (r *mutationResolver) CreatePolicy(ctx context.Context, input types.CreateP
|
||||
Name: input.Name,
|
||||
Content: input.Content,
|
||||
Status: input.Status,
|
||||
ReviewDate: input.ReviewDate,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot create policy: %w", err)
|
||||
@@ -400,6 +401,7 @@ func (r *mutationResolver) UpdatePolicy(ctx context.Context, input types.UpdateP
|
||||
Name: input.Name,
|
||||
Content: input.Content,
|
||||
Status: input.Status,
|
||||
ReviewDate: input.ReviewDate,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot update policy: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user