πŸ” 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

FieldTypeDescription
ownerForeign Key UserRequest owner (nullable).
old_domainstrDomain to be replaced.
new_domainstrTarget domain.
fields_to_updateJSON list[str]Offer fields to update (e.g. trafficback_url, url).
statusstrProcessing status (see below).
created_atdatetimeRequest creation timestamp.
processed_atdatetimeWhen the task finished (nullable).
accepted_offersJSON list[int]Offer IDs updated successfully.
rejected_offersJSON list[object]Failed offers with error details (offer_id, error).
logstextHuman-readable logs from processing.

🏷 Statuses

StatusDescription
pendingWaiting for processing.
partially_completedSome offers were updated, some failed.
completedAll matching offers were updated successfully.
failedNo offers were updated successfully.

πŸ’‘ Notes

  • Domains are validated in clean().
  • fields_to_update is validated to be a non-empty list with unique values from trafficback_url / url.
  • The processing task fills processed_at, accepted_offers, rejected_offers, and logs.