(ctx context.Context, task *ent.Task, args *TaskArgs)
| 140 | } |
| 141 | |
| 142 | func (c *taskClient) Update(ctx context.Context, task *ent.Task, args *TaskArgs) (*ent.Task, error) { |
| 143 | stm := c.client.Task.UpdateOne(task). |
| 144 | SetPublicState(args.PublicState) |
| 145 | |
| 146 | task.PublicState = args.PublicState |
| 147 | |
| 148 | if task.PrivateState != "" { |
| 149 | stm.SetPrivateState(task.PrivateState) |
| 150 | task.PrivateState = args.PrivateState |
| 151 | } |
| 152 | |
| 153 | if task.Status != "" { |
| 154 | stm.SetStatus(args.Status) |
| 155 | task.Status = args.Status |
| 156 | } |
| 157 | |
| 158 | if err := stm.Exec(ctx); err != nil { |
| 159 | return nil, fmt.Errorf("failed to create task: %w", err) |
| 160 | } |
| 161 | |
| 162 | return task, nil |
| 163 | } |
| 164 | |
| 165 | func (c *taskClient) GetPendingTasks(ctx context.Context, taskType ...string) ([]*ent.Task, error) { |
| 166 | tasks, err := withTaskEagerLoading(ctx, c.client.Task.Query()). |
nothing calls this directly
no test coverage detected