Resolves reporting currency, fetches exchange rates and converts amounts for financial records in the CRM.
// Source: https://github.com/mperkins0155/crm | License: MIT | Copyright 2026 Comp AI
// Provided via justclaw.it.com; keep this notice with the code.
import type { Db, Prisma as PrismaTypes } from "@crm/db";
import { Prisma } from "@crm/db";
import { minorUnitsOf, normalizeCurrency } from "@crm/db/currency";
import {
type Conversion,
convertToBase,
type ResolvedRate,
resolveRate,
} from "@crm/db/fx";
import { readReportingCurrency } from "@crm/db/settings";
import { Injectable, Logger } from "@nestjs/common";
import { InjectDatabase } from "../database/database.constants";
export interface DealFxFields {
baseAmount: PrismaTypes.Decimal | null;
baseCurrency: string | null;
fxRate: PrismaTypes.Decimal | null;
fxRateAt: Date | null;
}
export interface Unconverted {
count: number;
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key