krona-front/src/services/contracts/crm.ts

45 lines
1.4 KiB
TypeScript

import { Contact } from '../../entities/crm/contact';
import { Company } from '../../entities/crm/company';
import { Lead } from '../../entities/crm/lead';
import { Deal } from '../../entities/crm/deal';
import { BaseEntity } from '../../entities/types';
import { IRepository } from './repository';
export interface Activity extends BaseEntity {
targetEntityType: 'contact' | 'company' | 'deal' | 'lead';
targetEntityId: string;
type: 'call' | 'meeting' | 'task' | 'email' | 'message';
title: string;
description?: string;
dueDate?: string;
completed: boolean;
assignedTo?: string;
}
export interface Note extends BaseEntity {
targetEntityType: 'contact' | 'company' | 'deal' | 'lead';
targetEntityId: string;
content: string;
authorName: string;
pinned?: boolean;
}
export interface TimelineItem {
id: string;
timestamp: string;
type: 'activity' | 'note' | 'status_change' | 'deal_created' | 'order_created';
title: string;
description?: string;
actor: string;
}
export interface ICrmService {
contacts: IRepository<Contact>;
companies: IRepository<Company>;
leads: IRepository<Lead>;
deals: IRepository<Deal>;
activities: IRepository<Activity>;
notes: IRepository<Note>;
getTimeline(entityType: string, entityId: string): Promise<TimelineItem[]>;
convertLeadToDeal(leadId: string, dealTitle: string): Promise<{ deal: Deal; contact?: Contact }>;
}