osTicket's own REST API only supports creating tickets, not listing or reading them, so this reads osTicket's MySQL/MariaDB database directly with a read-only user instead - the only integration in this app that isn't a REST API. Joins the ticket, status, priority, department, staff, team, and user tables, filtered to tickets in the "open" state (status names are customizable per install, but that state flag isn't). Surfaces per-ticket subject, priority, department, assignee, requester, and osTicket's own overdue/awaiting-reply flags, plus a page at /osticket and a Dashboard widget with open/overdue/awaiting-reply counts. Not verified against a live instance: unlike the HTTP-based integrations, there was no way to fake a MySQL server to test against in this environment, so the query is built from osTicket's published schema but has never actually run against a real database. See INTEGRATIONS.md for the read-only grant needed and further caveats. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
51 lines
2.1 KiB
TypeScript
51 lines
2.1 KiB
TypeScript
import type { IntegrationType } from "../db/schema.js";
|
|
import type { IntegrationConfig } from "./types.js";
|
|
import { createTailscaleAdapter } from "./tailscale/adapter.js";
|
|
import { createGiteaAdapter } from "./gitea/adapter.js";
|
|
import { createDockhandAdapter } from "./dockhand/adapter.js";
|
|
import { createSemaphoreAdapter } from "./semaphore/adapter.js";
|
|
import { createProxmoxAdapter } from "./proxmox/adapter.js";
|
|
import { createSynologyAdapter } from "./synology/adapter.js";
|
|
import { createUptimeKumaAdapter } from "./uptimekuma/adapter.js";
|
|
import { createPhpIpamAdapter } from "./phpipam/adapter.js";
|
|
import { createPbsAdapter } from "./pbs/adapter.js";
|
|
import { createOsTicketAdapter } from "./osticket/adapter.js";
|
|
|
|
export interface PingableAdapter {
|
|
ping(): Promise<{ ok: boolean; latencyMs?: number; error?: string }>;
|
|
}
|
|
|
|
/**
|
|
* Generic dispatch used only where a ping() is all that's needed (the "test
|
|
* connection" endpoint). Type-specific routes construct their own concrete
|
|
* adapter directly (see requireTailscaleAdapter / requireGiteaAdapter in
|
|
* routes/integrations.ts) so a not-yet-implemented type can never throw here
|
|
* for an existing row of some OTHER type.
|
|
*/
|
|
export function createIntegrationAdapter(type: IntegrationType, config: IntegrationConfig): PingableAdapter {
|
|
switch (type) {
|
|
case "tailscale":
|
|
return createTailscaleAdapter(config as any);
|
|
case "gitea":
|
|
return createGiteaAdapter(config as any);
|
|
case "dockhand":
|
|
return createDockhandAdapter(config as any);
|
|
case "semaphore":
|
|
return createSemaphoreAdapter(config as any);
|
|
case "proxmox":
|
|
return createProxmoxAdapter(config as any);
|
|
case "synology":
|
|
return createSynologyAdapter(config as any);
|
|
case "uptimekuma":
|
|
return createUptimeKumaAdapter(config as any);
|
|
case "phpipam":
|
|
return createPhpIpamAdapter(config as any);
|
|
case "pbs":
|
|
return createPbsAdapter(config as any);
|
|
case "osticket":
|
|
return createOsTicketAdapter(config as any);
|
|
default:
|
|
throw new Error(`Integration type "${type}" is not implemented yet`);
|
|
}
|
|
}
|