Summary
Campaigns with an endDate remain marked active: true in the DB forever after their end date passes — unless an operator manually calls PUT /api/v1/campaigns/:id to deactivate them. An automated background job should deactivate expired campaigns and optionally call the on-chain set_active(false) if a contract is linked.
Problem
In backend/src/index.js, the jobRunner only runs rpc_health_poll. There is no job that checks for expired campaigns.
Acceptance Criteria
References
backend/src/jobs/jobRunner.js
backend/src/index.js — job registration
Summary
Campaigns with an
endDateremain markedactive: truein the DB forever after their end date passes — unless an operator manually callsPUT /api/v1/campaigns/:idto deactivate them. An automated background job should deactivate expired campaigns and optionally call the on-chainset_active(false)if a contract is linked.Problem
In
backend/src/index.js, thejobRunneronly runsrpc_health_poll. There is no job that checks for expired campaigns.Acceptance Criteria
campaign_expiry_checkjob tojobRunnerthat runs every 5 minutes (configurable viaEXPIRY_CHECK_INTERVAL_MS)SELECT * FROM campaigns WHERE active = 1 AND endDate IS NOT NULL AND endDate < NOW()active = falsein DB, write an audit log entry with actorsystem:expiry-jobcampaignContractIdis set and the backend has an admin key configured (STELLAR_ADMIN_KEYenv): build and submitset_active(false)transaction to the campaign contractcampaign.deactivatedwebhook event (when webhooks from issue Backend: Add webhook/notification system for campaign events #287 are available)References
backend/src/jobs/jobRunner.jsbackend/src/index.js— job registration