(
ref: ConnectionRef,
input: UpdateConnectionInput,
)
| 3703 | findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null))); |
| 3704 | |
| 3705 | const connectionsUpdate = ( |
| 3706 | ref: ConnectionRef, |
| 3707 | input: UpdateConnectionInput, |
| 3708 | ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> => |
| 3709 | Effect.gen(function* () { |
| 3710 | const row = yield* findConnectionRow(ref); |
| 3711 | if (!row) { |
| 3712 | return yield* new ConnectionNotFoundError({ |
| 3713 | owner: ref.owner, |
| 3714 | integration: ref.integration, |
| 3715 | name: ref.name, |
| 3716 | }); |
| 3717 | } |
| 3718 | const set: Record<string, unknown> = { updated_at: new Date() }; |
| 3719 | if (input.description !== undefined) set.description = input.description; |
| 3720 | if (input.identityLabel !== undefined) set.identity_label = input.identityLabel; |
| 3721 | yield* core.updateMany("connection", { |
| 3722 | where: (b: AnyCb) => |
| 3723 | b.and( |
| 3724 | byOwner(ref.owner)(b), |
| 3725 | b("integration", "=", String(ref.integration)), |
| 3726 | b("name", "=", String(ref.name)), |
| 3727 | ), |
| 3728 | set, |
| 3729 | }); |
| 3730 | const updated = yield* findConnectionRow(ref); |
| 3731 | return rowToConnection(updated ?? row); |
| 3732 | }); |
| 3733 | |
| 3734 | const connectionsRemove = ( |
| 3735 | ref: ConnectionRef, |
no test coverage detected