(ctx context.Context, task *TaskArgs)
| 89 | } |
| 90 | |
| 91 | func (c *taskClient) New(ctx context.Context, task *TaskArgs) (*ent.Task, error) { |
| 92 | stm := c.client.Task. |
| 93 | Create(). |
| 94 | SetType(task.Type). |
| 95 | SetPublicState(task.PublicState) |
| 96 | if task.PrivateState != "" { |
| 97 | stm.SetPrivateState(task.PrivateState) |
| 98 | } |
| 99 | |
| 100 | if task.OwnerID != 0 { |
| 101 | stm.SetUserID(task.OwnerID) |
| 102 | } |
| 103 | |
| 104 | if task.Status != "" { |
| 105 | stm.SetStatus(task.Status) |
| 106 | } |
| 107 | |
| 108 | if task.CorrelationID.String() != uuid.Nil.String() { |
| 109 | stm.SetCorrelationID(task.CorrelationID) |
| 110 | } |
| 111 | |
| 112 | newTask, err := stm.Save(ctx) |
| 113 | if err != nil { |
| 114 | return nil, fmt.Errorf("failed to create task: %w", err) |
| 115 | } |
| 116 | |
| 117 | return newTask, nil |
| 118 | } |
| 119 | |
| 120 | func (c *taskClient) DeleteByIDs(ctx context.Context, ids ...int) error { |
| 121 | _, err := c.client.Task.Delete().Where(task.IDIn(ids...)).Exec(ctx) |
nothing calls this directly
no test coverage detected