refactor: add logging to CreateTask resolver
This commit is contained in:
parent
46e724e731
commit
dd50baa05a
@ -180,13 +180,18 @@ func (r *mutationResolver) UpdateProjectMemberRole(ctx context.Context, input Up
|
|||||||
|
|
||||||
func (r *mutationResolver) CreateTask(ctx context.Context, input NewTask) (*db.Task, error) {
|
func (r *mutationResolver) CreateTask(ctx context.Context, input NewTask) (*db.Task, error) {
|
||||||
taskGroupID, err := uuid.Parse(input.TaskGroupID)
|
taskGroupID, err := uuid.Parse(input.TaskGroupID)
|
||||||
createdAt := time.Now().UTC()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.WithError(err).Error("issue while parsing task group ID")
|
||||||
return &db.Task{}, err
|
return &db.Task{}, err
|
||||||
}
|
}
|
||||||
|
createdAt := time.Now().UTC()
|
||||||
|
log.WithFields(log.Fields{"positon": input.Position, "taskGroupID": taskGroupID}).Info("creating task")
|
||||||
task, err := r.Repository.CreateTask(ctx, db.CreateTaskParams{taskGroupID, createdAt, input.Name, input.Position})
|
task, err := r.Repository.CreateTask(ctx, db.CreateTaskParams{taskGroupID, createdAt, input.Name, input.Position})
|
||||||
return &task, err
|
if err != nil {
|
||||||
|
log.WithError(err).Error("issue while creating task")
|
||||||
|
return &db.Task{}, err
|
||||||
|
}
|
||||||
|
return &task, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *mutationResolver) DeleteTask(ctx context.Context, input DeleteTaskInput) (*DeleteTaskPayload, error) {
|
func (r *mutationResolver) DeleteTask(ctx context.Context, input DeleteTaskInput) (*DeleteTaskPayload, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user