Remove mandatory task from measure
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -3725,6 +3725,7 @@ input UpdateTaskInput {
|
||||
timeEstimate: Duration @goField(omittable: true)
|
||||
deadline: Datetime @goField(omittable: true)
|
||||
assignedToId: ID @goField(omittable: true)
|
||||
measureId: ID @goField(omittable: true)
|
||||
}
|
||||
|
||||
input DeleteTaskInput {
|
||||
|
||||
@@ -13945,6 +13945,7 @@ input UpdateTaskInput {
|
||||
timeEstimate: Duration @goField(omittable: true)
|
||||
deadline: Datetime @goField(omittable: true)
|
||||
assignedToId: ID @goField(omittable: true)
|
||||
measureId: ID @goField(omittable: true)
|
||||
}
|
||||
|
||||
input DeleteTaskInput {
|
||||
@@ -68042,7 +68043,7 @@ func (ec *executionContext) unmarshalInputUpdateTaskInput(ctx context.Context, o
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"taskId", "name", "description", "state", "timeEstimate", "deadline", "assignedToId"}
|
||||
fieldsInOrder := [...]string{"taskId", "name", "description", "state", "timeEstimate", "deadline", "assignedToId", "measureId"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -68098,6 +68099,13 @@ func (ec *executionContext) unmarshalInputUpdateTaskInput(ctx context.Context, o
|
||||
return it, err
|
||||
}
|
||||
it.AssignedToID = graphql.OmittableOf(data)
|
||||
case "measureId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("measureId"))
|
||||
data, err := ec.unmarshalOID2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.MeasureID = graphql.OmittableOf(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2307,6 +2307,7 @@ type UpdateTaskInput struct {
|
||||
TimeEstimate graphql.Omittable[*time.Duration] `json:"timeEstimate,omitempty"`
|
||||
Deadline graphql.Omittable[*time.Time] `json:"deadline,omitempty"`
|
||||
AssignedToID graphql.Omittable[*gid.GID] `json:"assignedToId,omitempty"`
|
||||
MeasureID graphql.Omittable[*gid.GID] `json:"measureId,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateTaskPayload struct {
|
||||
|
||||
@@ -2790,7 +2790,7 @@ func (r *mutationResolver) DeleteControlSnapshotMapping(ctx context.Context, inp
|
||||
func (r *mutationResolver) CreateTask(ctx context.Context, input types.CreateTaskInput) (*types.CreateTaskPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.OrganizationID, authz.ActionCreateTask)
|
||||
|
||||
prb := r.ProboService(ctx, input.MeasureID.TenantID())
|
||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||
|
||||
task, err := prb.Tasks.Create(ctx, probo.CreateTaskRequest{
|
||||
MeasureID: input.MeasureID,
|
||||
@@ -2828,6 +2828,7 @@ func (r *mutationResolver) UpdateTask(ctx context.Context, input types.UpdateTas
|
||||
TimeEstimate: UnwrapOmittable(input.TimeEstimate),
|
||||
Deadline: UnwrapOmittable(input.Deadline),
|
||||
AssignedToID: UnwrapOmittable(input.AssignedToID),
|
||||
MeasureID: UnwrapOmittable(input.MeasureID),
|
||||
})
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot update task: %w", err))
|
||||
@@ -6798,6 +6799,10 @@ func (r *taskResolver) Measure(ctx context.Context, obj *types.Task) (*types.Mea
|
||||
panic(fmt.Errorf("cannot get task: %w", err))
|
||||
}
|
||||
|
||||
if task.MeasureID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
measure, err := prb.Measures.Get(ctx, *task.MeasureID)
|
||||
if err != nil {
|
||||
var errNotFound *coredata.ErrMeasureNotFound
|
||||
|
||||
Reference in New Issue
Block a user