contact-routes.ts — REST API for CRM contact management. Supports list, detail, create, update, delete, pipeline view, and tag updates. All routes require JWT auth and are scoped to user's org. /
/**
* contact-routes.ts — REST API for CRM contact management.
* Supports list, detail, create, update, delete, pipeline view, and tag updates.
* All routes require JWT auth and are scoped to user's org.
*/
import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { prisma } from '../../shared/database/prisma-client.js';
import { authMiddleware } from '../auth/auth-middleware.js';
import { logger } from '../../shared/utils/logger.js';
type QueryParams = Record<string, string>;
export async function contactRoutes(app: FastifyInstance): Promise<void> {
app.addHook('preHandler', authMiddleware);
// ── GET /api/v1/contacts — list with filters and pagination ───────────────
app.get('/api/v1/contacts', async (request: FastifyRequest, reply: FastifyReply) =
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key