π Overview
AffiseSwitchRequest stores an asynchronous request to replace a domain inside Affise offer URLs.
A request is typically created from the admin UI; after creation it is processed by a Celery task that:
- finds offers by
old_domain - updates each offerβs selected fields to use
new_domain - stores accepted offers, rejected offers (with error details), and logs
π Fields
| Field | Type | Description |
|---|---|---|
owner | Foreign Key User | Request owner (nullable). |
old_domain | str | Domain to be replaced. |
new_domain | str | Target domain. |
fields_to_update | JSON list[str] | Offer fields to update (e.g. trafficback_url, url). |
status | str | Processing status (see below). |
created_at | datetime | Request creation timestamp. |
processed_at | datetime | When the task finished (nullable). |
accepted_offers | JSON list[int] | Offer IDs updated successfully. |
rejected_offers | JSON list[object] | Failed offers with error details (offer_id, error). |
logs | text | Human-readable logs from processing. |
π· Statuses
| Status | Description |
|---|---|
pending | Waiting for processing. |
partially_completed | Some offers were updated, some failed. |
completed | All matching offers were updated successfully. |
failed | No offers were updated successfully. |
π‘ Notes
- Domains are validated in
clean(). fields_to_updateis validated to be a non-empty list with unique values fromtrafficback_url/url.- The processing task fills
processed_at,accepted_offers,rejected_offers, andlogs.