apps/gateway/src/routes/adapters.ts
Metadata
- Purpose: Gateway HTTP route handlers and request/response behavior.
- Domain:
applications - Language:
ts - Bytes: 4270
- Lines: 127
- Content hash (short):
47e91b34 - Source (start): apps/gateway/src/routes/adapters.ts:1
- Source (end): apps/gateway/src/routes/adapters.ts:127
Indexed Symbols
No indexed functions/methods detected in this file.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import type { FastifyPluginAsync } from "fastify";
import { getIdempotencyKey, getIdempotencyRouteScope } from "../utils/idempotency.js";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";
import { sendAccountingSync } from "../services/providers/accounting.js";
import { sendNotificationTest } from "../services/providers/notifications.js";
import { ensureRoles } from "../utils/authorization.js";
type AccountingSyncRequest = {
provider: "quickbooks" | "xero";
syncType: "customers" | "invoices" | "payments" | "catalog";
since?: string;
};
type NotificationTestRequest = {
channel: "slack" | "email" | "teams";
target: string;
message?: string;
};
export const adapterRoutes: FastifyPluginAsync = async (app) => {
app.post("/api/v1/integrations/accounting/sync", async (request, reply) => {
if (!ensureRoles(request, reply, ["msp_admin", "integration_admin"])) {
return { error: "Insufficient role for accounting sync" };
}