task-ep.1.2

This commit is contained in:
phaichayon
2026-07-13 09:49:45 +07:00
parent 9ae4f31f28
commit e96320a24d
28 changed files with 1337 additions and 21 deletions

View File

@@ -1,6 +1,42 @@
import { formatCrmActivityLabel } from '@/features/crm/activity/types';
import type { ActivityTimelineItem } from '../../api/types';
import type { OpportunityFollowupRecord } from '@/features/crm/opportunities/api/types';
export interface OpportunityFollowupAdapterCandidate {
source: 'opportunity_followup';
followup: OpportunityFollowupRecord;
followupTypeLabel?: string | null;
createdByName?: string | null;
}
export function adaptOpportunityFollowupCandidate(
candidate: OpportunityFollowupAdapterCandidate
): ActivityTimelineItem {
const typeLabel =
candidate.followupTypeLabel ?? formatCrmActivityLabel(candidate.followup.followupType);
return {
id: candidate.followup.id,
source: 'opportunity_followup',
sourceLabel: 'Opportunity Follow-up',
isLegacy: true,
activityId: null,
activityCode: null,
primaryEntityType: 'opportunity',
primaryEntityId: candidate.followup.opportunityId,
primaryRecordLabel: null,
activityType: 'follow_up',
activityTypeLabel: typeLabel,
subject: typeLabel,
description: candidate.followup.outcome ?? candidate.followup.notes,
status: 'completed',
statusLabel: 'Completed',
occurredAt: candidate.followup.followupDate,
scheduledAt: candidate.followup.followupDate,
dueAt: candidate.followup.nextFollowupDate,
nextAction: candidate.followup.nextAction,
ownerName: null,
assignedToName: null,
createdByName: candidate.createdByName ?? null
};
}