33 lines
895 B
TypeScript
33 lines
895 B
TypeScript
import { type Database } from "@link-stack/bridge-common";
|
|
import type { ServiceConfig } from "../lib/service";
|
|
import { facebookConfig as facebook } from "./facebook";
|
|
import { signalConfig as signal } from "./signal";
|
|
import { whatsappConfig as whatsapp } from "./whatsapp";
|
|
import { voiceConfig as voice } from "./voice";
|
|
import { webhooksConfig as webhooks } from "./webhooks";
|
|
import { usersConfig as users } from "./users";
|
|
|
|
export const serviceConfig: Record<string, ServiceConfig> = {
|
|
facebook,
|
|
signal,
|
|
whatsapp,
|
|
voice,
|
|
webhooks,
|
|
users,
|
|
};
|
|
|
|
export const getServiceTable = (service: string): keyof Database => {
|
|
const tableLookup: Record<string, keyof Database> = {
|
|
facebook: "FacebookBot",
|
|
signal: "SignalBot",
|
|
whatsapp: "WhatsappBot",
|
|
};
|
|
|
|
const table = tableLookup[service];
|
|
|
|
if (!table) {
|
|
throw new Error("Table not found");
|
|
}
|
|
|
|
return table;
|
|
};
|