refactor: distribute types from crm-types.ts to owning composables

Each composable now owns its types and exports them. Other composables
import types from the owning composable. Deleted centralized crm-types.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ruslan Bakiev
2026-02-24 15:21:30 +07:00
parent a4d8d81de9
commit d892d0c604
14 changed files with 425 additions and 435 deletions

View File

@@ -1,8 +1,34 @@
import { ref, computed, watch, type ComputedRef, type Ref } from "vue";
import { useQuery } from "@vue/apollo-composable";
import { DealsQueryDocument } from "~~/graphql/generated";
import type { Deal, DealStep, CalendarEvent, Contact } from "~/composables/crm-types";
import { safeTrim, formatDay } from "~/composables/crm-types";
import type { Contact } from "~/composables/useContacts";
import type { CalendarEvent } from "~/composables/useCalendar";
import { formatDay } from "~/composables/useCalendar";
export type DealStep = {
id: string;
title: string;
description: string;
status: "todo" | "in_progress" | "done" | "blocked" | string;
dueAt: string;
order: number;
completedAt: string;
};
export type Deal = {
id: string;
contact: string;
title: string;
stage: string;
amount: string;
nextStep: string;
summary: string;
currentStepId: string;
steps: DealStep[];
};
function safeTrim(value: unknown) { return String(value ?? "").trim(); }
export function useDeals(opts: {
apolloAuthReady: ComputedRef<boolean>;