Refactoring 2
This commit is contained in:
parent
dd14dfe72e
commit
e4b78ceec2
76 changed files with 870 additions and 734 deletions
33
packages/bridge-ui/config/config.ts
Normal file
33
packages/bridge-ui/config/config.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { type Database } from "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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue