# Execute content transfer

Executes the ownership transfer for a product transfer job. Calls `ows-project-manager` to atomically reassign ownership of the job's project, releases, and associated video rows to the destination vendor.

## Event payload

### Input

| Field | Type | Description |
|-------|------|-------------|
| `job_id` | `int` | ID of the transfer job to execute. |

Additional fields from the Step Function state are passed through unchanged.

### Output

Returns the input event merged with `execute_content_transfer_result`:

| Field | Type | Description |
|-------|------|-------------|
| `execute_content_transfer_result.project_updated` | `int` | Number of projects updated. |
| `execute_content_transfer_result.releases_updated` | `int` | Number of releases updated. |
| `execute_content_transfer_result.video_rows_updated` | `int` | Number of video rows updated. |

## Setup

This Lambda uses M2M token authentication, which requires AWS access to retrieve credentials at runtime. See [AWS Access](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f) for setup instructions.

Run locally — exposes the Lambda invocation endpoint on port 9000:
```sh
docker compose up dev
```

Invoke the function in a second terminal:
```sh
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"job_id": 123}'
```

## Development

Run linting and tests:
```sh
docker compose run --rm --build unit-lint
```

Format code:
```sh
docker compose run --rm --build format
```

Update the lock file (required after changing `pyproject.toml`):
```sh
docker compose run --rm --build update-lockfile
```
