Schema (migration 0001): - clients: add currency column (default USD) - invoices: add currency column (default USD) - New expenses table: amount, currency, category, billable, reimbursable, client/invoice/business relations, notes - New invoice_templates table: name, type (notes|terms), content, isDefault API: - invoices: add bulkUpdateStatus and bulkDelete procedures (ownership-safe) - invoices: currency field threaded through create/update schemas - clients: currency field added to create/update schemas - New expenses router: full CRUD with authorization - New invoiceTemplates router: full CRUD, isDefault management per type - Root router: wire in expenses and invoiceTemplates Currency (src/lib/currency.ts): - Shared formatCurrency(amount, currency) utility replacing hardcoded USD - SUPPORTED_CURRENCIES list (17 currencies) - Invoice form: currency selector in Config card, auto-fills from client - Client form: currency selector in Billing Information card Bulk actions (invoices list): - Checkbox column with select-all support - Selection toolbar: Mark as Sent/Paid/Draft dropdown, Delete (N) button - DataTable: new selectionActions prop renders toolbar when rows selected Notes templates: - Invoice form: Notes card with textarea in Details tab - Template dropdown button appears when templates exist - /dashboard/invoices/templates: full CRUD page for notes and terms templates New pages: - /dashboard/expenses: expense list with summary cards, add/edit dialog - /dashboard/reports: KPI cards, 12-month revenue area chart, top clients bar chart, status breakdown, recent activity - Navigation: Expenses and Reports added to Main section https://claude.ai/code/session_012sqEgNQpx676isepeoX4Mi
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { clientsRouter } from "~/server/api/routers/clients";
|
|
import { businessesRouter } from "~/server/api/routers/businesses";
|
|
import { invoicesRouter } from "~/server/api/routers/invoices";
|
|
import { settingsRouter } from "~/server/api/routers/settings";
|
|
import { emailRouter } from "~/server/api/routers/email";
|
|
import { dashboardRouter } from "~/server/api/routers/dashboard";
|
|
import { expensesRouter } from "~/server/api/routers/expenses";
|
|
import { invoiceTemplatesRouter } from "~/server/api/routers/invoiceTemplates";
|
|
import { createCallerFactory, createTRPCRouter } from "~/server/api/trpc";
|
|
|
|
/**
|
|
* This is the primary router for your server.
|
|
*
|
|
* All routers added in /api/routers should be manually added here.
|
|
*/
|
|
export const appRouter = createTRPCRouter({
|
|
clients: clientsRouter,
|
|
businesses: businessesRouter,
|
|
invoices: invoicesRouter,
|
|
settings: settingsRouter,
|
|
email: emailRouter,
|
|
dashboard: dashboardRouter,
|
|
expenses: expensesRouter,
|
|
invoiceTemplates: invoiceTemplatesRouter,
|
|
});
|
|
|
|
// export type definition of API
|
|
export type AppRouter = typeof appRouter;
|
|
|
|
/**
|
|
* Create a server-side caller for the tRPC API.
|
|
* @example
|
|
* const trpc = createCaller(createContext);
|
|
* const res = await trpc.clients.getAll();
|
|
* ^? Client[]
|
|
*/
|
|
export const createCaller = createCallerFactory(appRouter);
|