feat(campaigns): campaign start date — scheduled activation, Jira start_date
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
DB: migration b047 adds start_date (DateTime nullable) + index to campaigns. Backend: - Campaign model: start_date field - CampaignCreate/Update schemas: accept start_date (ISO string) - CRUD service: persist + serialize start_date in both serializers - Activation endpoint: blocks manual activation if start_date is in the future (campaign will auto-activate via scheduler) - Scheduler: new hourly job _run_scheduled_campaign_activation — finds draft campaigns with start_date <= now, activates them, creates Jira tickets, notifies red_tech team - Jira: campaign + test tickets now include JIRA_START_DATE_FIELD (configurable, default customfield_10015). Campaign uses start_date if set, else created_at. Tests inherit campaign start_date. - config.py: JIRA_START_DATE_FIELD setting Frontend: - Campaign type: start_date field on Campaign + CampaignSummary - CampaignCreatePayload: start_date optional field - Create form: date picker with min=today, warning message explaining behavior - Campaign detail header: start_date badge showing days remaining or started date Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -254,6 +254,24 @@ export default function CampaignDetailPage() {
|
||||
<Calendar className="h-3.5 w-3.5" />
|
||||
Created {formatDate(campaign.created_at)}
|
||||
</span>
|
||||
{campaign.start_date && (() => {
|
||||
const sd = new Date(campaign.start_date);
|
||||
const now = new Date();
|
||||
const isPast = sd <= now;
|
||||
const diffDays = Math.ceil((sd.getTime() - now.getTime()) / 86400000);
|
||||
return (
|
||||
<span className={`flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium ${
|
||||
isPast
|
||||
? "border-green-500/30 bg-green-500/10 text-green-400"
|
||||
: "border-amber-500/30 bg-amber-500/10 text-amber-400"
|
||||
}`}>
|
||||
<Clock className="h-3 w-3" />
|
||||
{isPast
|
||||
? `Started ${formatDate(campaign.start_date)}`
|
||||
: `Starts ${formatDate(campaign.start_date)} (${diffDays}d)`}
|
||||
</span>
|
||||
);
|
||||
})()}
|
||||
{campaign.completed_at && (
|
||||
<span className="flex items-center gap-1 text-green-400">
|
||||
<CheckCircle className="h-3.5 w-3.5" />
|
||||
|
||||
Reference in New Issue
Block a user