feat(campaigns): start_date for threat-actor-generated campaigns
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

Backend:
- campaign_service.generate_campaign_from_threat_actor: accept optional
  start_date kwarg and set it on the Campaign model
- campaigns router: new GenerateFromActorPayload schema, /from-threat-actor
  endpoint now accepts optional body with start_date

Frontend:
- generateCampaignFromThreatActor API: accept optional options param
- Generate Campaign modal: date picker + warning message, same UX as the
  manual create form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-06-04 13:37:40 +02:00
parent 498536f3f1
commit f8418bc7ea
4 changed files with 48 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ threat actors, and progress calculation.
import logging
import uuid
from datetime import datetime
from typing import Optional
from sqlalchemy.orm import Session
@@ -106,6 +107,8 @@ def generate_campaign_from_threat_actor(
db: Session,
actor_id: uuid.UUID,
user: User,
*,
start_date: Optional[datetime] = None,
) -> Campaign:
"""Auto-generate a campaign from a threat actor's uncovered techniques.
@@ -146,6 +149,7 @@ def generate_campaign_from_threat_actor(
status="draft",
created_by=user.id,
tags=[actor.name, "auto-generated"],
start_date=start_date,
)
db.add(campaign)
db.flush() # Get campaign.id