Fix audit and framework deletion
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -2155,7 +2155,7 @@ type Nonconformity implements Node {
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
referenceId: String!
|
||||
description: String
|
||||
audit: Audit! @goField(forceResolver: true)
|
||||
audit: Audit @goField(forceResolver: true)
|
||||
dateIdentified: Datetime
|
||||
rootCause: String!
|
||||
correctiveAction: String
|
||||
@@ -3661,7 +3661,7 @@ input CreateNonconformityInput {
|
||||
organizationId: ID!
|
||||
referenceId: String!
|
||||
description: String
|
||||
auditId: ID!
|
||||
auditId: ID
|
||||
dateIdentified: Datetime
|
||||
rootCause: String!
|
||||
correctiveAction: String
|
||||
@@ -3679,7 +3679,7 @@ input UpdateNonconformityInput {
|
||||
rootCause: String
|
||||
correctiveAction: String @goField(omittable: true)
|
||||
ownerId: ID
|
||||
auditId: ID
|
||||
auditId: ID @goField(omittable: true)
|
||||
dueDate: Datetime @goField(omittable: true)
|
||||
status: NonconformityStatus
|
||||
effectivenessCheck: String @goField(omittable: true)
|
||||
|
||||
@@ -11708,7 +11708,7 @@ type Nonconformity implements Node {
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
referenceId: String!
|
||||
description: String
|
||||
audit: Audit! @goField(forceResolver: true)
|
||||
audit: Audit @goField(forceResolver: true)
|
||||
dateIdentified: Datetime
|
||||
rootCause: String!
|
||||
correctiveAction: String
|
||||
@@ -13214,7 +13214,7 @@ input CreateNonconformityInput {
|
||||
organizationId: ID!
|
||||
referenceId: String!
|
||||
description: String
|
||||
auditId: ID!
|
||||
auditId: ID
|
||||
dateIdentified: Datetime
|
||||
rootCause: String!
|
||||
correctiveAction: String
|
||||
@@ -13232,7 +13232,7 @@ input UpdateNonconformityInput {
|
||||
rootCause: String
|
||||
correctiveAction: String @goField(omittable: true)
|
||||
ownerId: ID
|
||||
auditId: ID
|
||||
auditId: ID @goField(omittable: true)
|
||||
dueDate: Datetime @goField(omittable: true)
|
||||
status: NonconformityStatus
|
||||
effectivenessCheck: String @goField(omittable: true)
|
||||
@@ -37092,9 +37092,9 @@ func (ec *executionContext) _Nonconformity_audit(ctx context.Context, field grap
|
||||
return ec.resolvers.Nonconformity().Audit(ctx, obj)
|
||||
},
|
||||
nil,
|
||||
ec.marshalNAudit2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAudit,
|
||||
true,
|
||||
ec.marshalOAudit2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAudit,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57528,7 +57528,7 @@ func (ec *executionContext) unmarshalInputCreateNonconformityInput(ctx context.C
|
||||
it.Description = data
|
||||
case "auditId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("auditId"))
|
||||
data, err := ec.unmarshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
data, err := ec.unmarshalOID2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
@@ -62420,7 +62420,7 @@ func (ec *executionContext) unmarshalInputUpdateNonconformityInput(ctx context.C
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.AuditID = data
|
||||
it.AuditID = graphql.OmittableOf(data)
|
||||
case "dueDate":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dueDate"))
|
||||
data, err := ec.unmarshalODatetime2ᚖtimeᚐTime(ctx, v)
|
||||
@@ -73824,16 +73824,13 @@ func (ec *executionContext) _Nonconformity(ctx context.Context, sel ast.Selectio
|
||||
case "audit":
|
||||
field := field
|
||||
|
||||
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
|
||||
innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Nonconformity_audit(ctx, field, obj)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&fs.Invalids, 1)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -83347,10 +83344,6 @@ func (ec *executionContext) marshalNAssignTaskPayload2ᚖgoᚗproboᚗincᚋprob
|
||||
return ec._AssignTaskPayload(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAudit2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAudit(ctx context.Context, sel ast.SelectionSet, v types.Audit) graphql.Marshaler {
|
||||
return ec._Audit(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAudit2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAudit(ctx context.Context, sel ast.SelectionSet, v *types.Audit) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
|
||||
@@ -377,7 +377,7 @@ type CreateNonconformityInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
ReferenceID string `json:"referenceId"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AuditID gid.GID `json:"auditId"`
|
||||
AuditID *gid.GID `json:"auditId,omitempty"`
|
||||
DateIdentified *time.Time `json:"dateIdentified,omitempty"`
|
||||
RootCause string `json:"rootCause"`
|
||||
CorrectiveAction *string `json:"correctiveAction,omitempty"`
|
||||
@@ -1368,7 +1368,7 @@ type Nonconformity struct {
|
||||
Organization *Organization `json:"organization"`
|
||||
ReferenceID string `json:"referenceId"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Audit *Audit `json:"audit"`
|
||||
Audit *Audit `json:"audit,omitempty"`
|
||||
DateIdentified *time.Time `json:"dateIdentified,omitempty"`
|
||||
RootCause string `json:"rootCause"`
|
||||
CorrectiveAction *string `json:"correctiveAction,omitempty"`
|
||||
@@ -1997,7 +1997,7 @@ type UpdateNonconformityInput struct {
|
||||
RootCause *string `json:"rootCause,omitempty"`
|
||||
CorrectiveAction graphql.Omittable[*string] `json:"correctiveAction,omitempty"`
|
||||
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
||||
AuditID *gid.GID `json:"auditId,omitempty"`
|
||||
AuditID graphql.Omittable[*gid.GID] `json:"auditId,omitempty"`
|
||||
DueDate graphql.Omittable[*time.Time] `json:"dueDate,omitempty"`
|
||||
Status *coredata.NonconformityStatus `json:"status,omitempty"`
|
||||
EffectivenessCheck graphql.Omittable[*string] `json:"effectivenessCheck,omitempty"`
|
||||
|
||||
@@ -3984,7 +3984,7 @@ func (r *mutationResolver) UpdateNonconformity(ctx context.Context, input types.
|
||||
RootCause: input.RootCause,
|
||||
CorrectiveAction: UnwrapOmittable(input.CorrectiveAction),
|
||||
OwnerID: input.OwnerID,
|
||||
AuditID: input.AuditID,
|
||||
AuditID: UnwrapOmittable(input.AuditID),
|
||||
DueDate: UnwrapOmittable(input.DueDate),
|
||||
Status: input.Status,
|
||||
EffectivenessCheck: UnwrapOmittable(input.EffectivenessCheck),
|
||||
@@ -4596,7 +4596,11 @@ func (r *nonconformityResolver) Audit(ctx context.Context, obj *types.Nonconform
|
||||
panic(fmt.Errorf("cannot get nonconformity: %w", err))
|
||||
}
|
||||
|
||||
audit, err := prb.Audits.Get(ctx, nonconformity.AuditID)
|
||||
if nonconformity.AuditID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
audit, err := prb.Audits.Get(ctx, *nonconformity.AuditID)
|
||||
if err != nil {
|
||||
var errNotFound *coredata.ErrAuditNotFound
|
||||
if errors.As(err, &errNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user