diff --git a/.gitignore b/.gitignore index cc597ab..9ba6742 100644 --- a/.gitignore +++ b/.gitignore @@ -19,10 +19,10 @@ docker-compose.yml coverage .pgpass **/dist/** -.metamigo.local.json +.bridge.local.json out/ signald-state/* !./signald-state/.gitkeep baileys-state signald-state -project.org \ No newline at end of file +project.org diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8a2974..6f80211 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,16 +84,16 @@ leafcutter-docker-release: variables: DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/leafcutter -metamigo-docker-build: +bridge-docker-build: extends: .docker-build variables: - DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/metamigo - DOCKERFILE_PATH: ./apps/metamigo-cli/Dockerfile + DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/bridge + DOCKERFILE_PATH: ./apps/bridge-cli/Dockerfile -metamigo-docker-release: +bridge-docker-release: extends: .docker-release variables: - DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/metamigo + DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/bridge elasticsearch-docker-build: extends: .docker-build @@ -215,7 +215,7 @@ zammad-docker-release: extends: .docker-release variables: DOCKER_NS: ${CI_REGISTRY}/digiresilience/link/link-stack/zammad - + zammad-standalone-docker-build: extends: .docker-build variables: diff --git a/README.md b/README.md index 5b2659e..9a504ac 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Local dev with docker-compose -* Create `link-stack/.env` from Bitwarden `.env for root of link-stack` -* Run local dev with docker-compose: +- Create `link-stack/.env` from Bitwarden `.env for root of link-stack` +- Run local dev with docker-compose: ``` git clone ... cd link-stack @@ -14,23 +14,23 @@ Local dev with docker-compose Or for local dev of a single app -* Create `link-stack/apps/link/.env.local` from Bitwarden `.env.local for link-stack/apps/link` -* Create `link-stack/apps/metamigo-frontend/.metamigo.local.json` from Bitwarden `.metamigo.local.json for link-stack/apps/metamigo/frontend` -* Build locally for development: +- Create `link-stack/apps/link/.env.local` from Bitwarden `.env.local for link-stack/apps/link` +- Create `link-stack/apps/bridge-frontend/.bridge.local.json` from Bitwarden `.bridge.local.json for link-stack/apps/bridge/frontend` +- Build locally for development: ``` npm install - make dev-metamigo # this starts the containers + make dev-bridge # this starts the containers npm run migrate # this migrates the db - npm run dev:metamigo # this runs metamigo frontend and api + npm run dev:bridge # this runs bridge frontend and api ``` # TODO - [ ] Delete old JWT config stuff - [ ] Consolidate config -- [ ] Complete react-admin upgrade.. make all the metamigo-frontend stuff work - * https://marmelab.com/react-admin/Upgrade.html#no-more-prop-injection-in-page-components -- [ ] Get metamigo-worker working +- [ ] Complete react-admin upgrade.. make all the bridge-frontend stuff work + - https://marmelab.com/react-admin/Upgrade.html#no-more-prop-injection-in-page-components +- [ ] Get bridge-worker working - [ ] Migrate off mui/styles - * https://mui.com/material-ui/migration/v5-style-changes/ - * the codemods might help us? \ No newline at end of file + - https://mui.com/material-ui/migration/v5-style-changes/ + - the codemods might help us? diff --git a/apps/metamigo-frontend/.eslintrc.json b/apps/bridge-frontend/.eslintrc.json similarity index 100% rename from apps/metamigo-frontend/.eslintrc.json rename to apps/bridge-frontend/.eslintrc.json diff --git a/apps/metamigo-frontend/.gitignore b/apps/bridge-frontend/.gitignore similarity index 100% rename from apps/metamigo-frontend/.gitignore rename to apps/bridge-frontend/.gitignore diff --git a/apps/metamigo-frontend/README.md b/apps/bridge-frontend/README.md similarity index 100% rename from apps/metamigo-frontend/README.md rename to apps/bridge-frontend/README.md diff --git a/apps/metamigo-frontend/app/_actions/bots.ts b/apps/bridge-frontend/app/_actions/bots.ts similarity index 100% rename from apps/metamigo-frontend/app/_actions/bots.ts rename to apps/bridge-frontend/app/_actions/bots.ts diff --git a/apps/metamigo-frontend/app/_components/DeleteDialog.tsx b/apps/bridge-frontend/app/_components/DeleteDialog.tsx similarity index 100% rename from apps/metamigo-frontend/app/_components/DeleteDialog.tsx rename to apps/bridge-frontend/app/_components/DeleteDialog.tsx diff --git a/apps/metamigo-frontend/app/_components/Detail.tsx b/apps/bridge-frontend/app/_components/Detail.tsx similarity index 100% rename from apps/metamigo-frontend/app/_components/Detail.tsx rename to apps/bridge-frontend/app/_components/Detail.tsx diff --git a/apps/metamigo-frontend/app/_components/Edit.tsx b/apps/bridge-frontend/app/_components/Edit.tsx similarity index 100% rename from apps/metamigo-frontend/app/_components/Edit.tsx rename to apps/bridge-frontend/app/_components/Edit.tsx diff --git a/apps/metamigo-frontend/app/_components/InternalLayout.tsx b/apps/bridge-frontend/app/_components/InternalLayout.tsx similarity index 100% rename from apps/metamigo-frontend/app/_components/InternalLayout.tsx rename to apps/bridge-frontend/app/_components/InternalLayout.tsx diff --git a/apps/metamigo-frontend/app/_components/List.tsx b/apps/bridge-frontend/app/_components/List.tsx similarity index 100% rename from apps/metamigo-frontend/app/_components/List.tsx rename to apps/bridge-frontend/app/_components/List.tsx diff --git a/apps/metamigo-frontend/app/_components/Sidebar.tsx b/apps/bridge-frontend/app/_components/Sidebar.tsx similarity index 99% rename from apps/metamigo-frontend/app/_components/Sidebar.tsx rename to apps/bridge-frontend/app/_components/Sidebar.tsx index ec40825..645c386 100644 --- a/apps/metamigo-frontend/app/_components/Sidebar.tsx +++ b/apps/bridge-frontend/app/_components/Sidebar.tsx @@ -241,7 +241,7 @@ export const Sidebar: FC = ({ open, setOpen }) => { fontFamily: poppins.style.fontFamily, }} > - Metamigo + CDR Bridge )} diff --git a/apps/metamigo-frontend/app/_lib/authentication.ts b/apps/bridge-frontend/app/_lib/authentication.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/authentication.ts rename to apps/bridge-frontend/app/_lib/authentication.ts diff --git a/apps/metamigo-frontend/app/_lib/database.ts b/apps/bridge-frontend/app/_lib/database.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/database.ts rename to apps/bridge-frontend/app/_lib/database.ts diff --git a/apps/metamigo-frontend/app/_lib/facebook.ts b/apps/bridge-frontend/app/_lib/facebook.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/facebook.ts rename to apps/bridge-frontend/app/_lib/facebook.ts diff --git a/apps/metamigo-frontend/app/_lib/routing.ts b/apps/bridge-frontend/app/_lib/routing.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/routing.ts rename to apps/bridge-frontend/app/_lib/routing.ts diff --git a/apps/metamigo-frontend/app/_lib/service.ts b/apps/bridge-frontend/app/_lib/service.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/service.ts rename to apps/bridge-frontend/app/_lib/service.ts diff --git a/apps/metamigo-frontend/app/_lib/signal.ts b/apps/bridge-frontend/app/_lib/signal.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/signal.ts rename to apps/bridge-frontend/app/_lib/signal.ts diff --git a/apps/metamigo-frontend/app/_lib/voice.ts b/apps/bridge-frontend/app/_lib/voice.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/voice.ts rename to apps/bridge-frontend/app/_lib/voice.ts diff --git a/apps/metamigo-frontend/app/_lib/whatsapp.ts b/apps/bridge-frontend/app/_lib/whatsapp.ts similarity index 100% rename from apps/metamigo-frontend/app/_lib/whatsapp.ts rename to apps/bridge-frontend/app/_lib/whatsapp.ts diff --git a/apps/metamigo-frontend/app/_styles/theme.ts b/apps/bridge-frontend/app/_styles/theme.ts similarity index 100% rename from apps/metamigo-frontend/app/_styles/theme.ts rename to apps/bridge-frontend/app/_styles/theme.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/receive/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/receive/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/receive/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/receive/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/register/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/register/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/register/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/register/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/request-code/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/request-code/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/request-code/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/request-code/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/reset-session/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/reset-session/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/reset-session/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/reset-session/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/[token]/send/route.ts b/apps/bridge-frontend/app/api/[service]/bots/[token]/send/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/[token]/send/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/[token]/send/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/bots/route.ts b/apps/bridge-frontend/app/api/[service]/bots/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/bots/route.ts rename to apps/bridge-frontend/app/api/[service]/bots/route.ts diff --git a/apps/metamigo-frontend/app/api/[service]/webhooks/route.ts b/apps/bridge-frontend/app/api/[service]/webhooks/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/[service]/webhooks/route.ts rename to apps/bridge-frontend/app/api/[service]/webhooks/route.ts diff --git a/apps/metamigo-frontend/app/api/auth/[...nextauth]/route.ts b/apps/bridge-frontend/app/api/auth/[...nextauth]/route.ts similarity index 100% rename from apps/metamigo-frontend/app/api/auth/[...nextauth]/route.ts rename to apps/bridge-frontend/app/api/auth/[...nextauth]/route.ts diff --git a/apps/metamigo-frontend/app/facebook/[id]/edit/page.tsx b/apps/bridge-frontend/app/facebook/[id]/edit/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/facebook/[id]/edit/page.tsx rename to apps/bridge-frontend/app/facebook/[id]/edit/page.tsx diff --git a/apps/metamigo-frontend/app/facebook/[id]/page.tsx b/apps/bridge-frontend/app/facebook/[id]/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/facebook/[id]/page.tsx rename to apps/bridge-frontend/app/facebook/[id]/page.tsx diff --git a/apps/metamigo-frontend/app/facebook/new/page.tsx b/apps/bridge-frontend/app/facebook/new/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/facebook/new/page.tsx rename to apps/bridge-frontend/app/facebook/new/page.tsx diff --git a/apps/metamigo-frontend/app/facebook/page.tsx b/apps/bridge-frontend/app/facebook/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/facebook/page.tsx rename to apps/bridge-frontend/app/facebook/page.tsx diff --git a/apps/metamigo-frontend/app/favicon.ico b/apps/bridge-frontend/app/favicon.ico similarity index 100% rename from apps/metamigo-frontend/app/favicon.ico rename to apps/bridge-frontend/app/favicon.ico diff --git a/apps/metamigo-frontend/app/layout.tsx b/apps/bridge-frontend/app/layout.tsx similarity index 73% rename from apps/metamigo-frontend/app/layout.tsx rename to apps/bridge-frontend/app/layout.tsx index ccee1a3..cbd4e25 100644 --- a/apps/metamigo-frontend/app/layout.tsx +++ b/apps/bridge-frontend/app/layout.tsx @@ -2,10 +2,12 @@ import type { Metadata } from "next"; import { InternalLayout } from "./_components/InternalLayout"; import { LicenseInfo } from "@mui/x-license"; -LicenseInfo.setLicenseKey("7c9bf25d9e240f76e77cbf7d2ba58a23Tz02NjU4OCxFPTE3MTU4NjIzMzQ2ODgsUz1wcm8sTE09c3Vic2NyaXB0aW9uLEtWPTI="); +LicenseInfo.setLicenseKey( + "7c9bf25d9e240f76e77cbf7d2ba58a23Tz02NjU4OCxFPTE3MTU4NjIzMzQ2ODgsUz1wcm8sTE09c3Vic2NyaXB0aW9uLEtWPTI=", +); export const metadata: Metadata = { - title: "Metamigo", + title: "CDR Bridge", description: "", }; diff --git a/apps/metamigo-frontend/app/page.module.css b/apps/bridge-frontend/app/page.module.css similarity index 100% rename from apps/metamigo-frontend/app/page.module.css rename to apps/bridge-frontend/app/page.module.css diff --git a/apps/metamigo-frontend/app/page.tsx b/apps/bridge-frontend/app/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/page.tsx rename to apps/bridge-frontend/app/page.tsx diff --git a/apps/metamigo-frontend/app/signal/[id]/page.tsx b/apps/bridge-frontend/app/signal/[id]/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/signal/[id]/page.tsx rename to apps/bridge-frontend/app/signal/[id]/page.tsx diff --git a/apps/metamigo-frontend/app/signal/new/page.tsx b/apps/bridge-frontend/app/signal/new/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/signal/new/page.tsx rename to apps/bridge-frontend/app/signal/new/page.tsx diff --git a/apps/metamigo-frontend/app/signal/page.tsx b/apps/bridge-frontend/app/signal/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/signal/page.tsx rename to apps/bridge-frontend/app/signal/page.tsx diff --git a/apps/metamigo-frontend/app/users/page.tsx b/apps/bridge-frontend/app/users/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/users/page.tsx rename to apps/bridge-frontend/app/users/page.tsx diff --git a/apps/metamigo-frontend/app/voice/[id]/edit/page.tsx b/apps/bridge-frontend/app/voice/[id]/edit/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/voice/[id]/edit/page.tsx rename to apps/bridge-frontend/app/voice/[id]/edit/page.tsx diff --git a/apps/metamigo-frontend/app/voice/[id]/page.tsx b/apps/bridge-frontend/app/voice/[id]/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/voice/[id]/page.tsx rename to apps/bridge-frontend/app/voice/[id]/page.tsx diff --git a/apps/metamigo-frontend/app/voice/new/page.tsx b/apps/bridge-frontend/app/voice/new/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/voice/new/page.tsx rename to apps/bridge-frontend/app/voice/new/page.tsx diff --git a/apps/metamigo-frontend/app/voice/page.tsx b/apps/bridge-frontend/app/voice/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/voice/page.tsx rename to apps/bridge-frontend/app/voice/page.tsx diff --git a/apps/metamigo-frontend/app/whatsapp/[id]/edit/page.tsx b/apps/bridge-frontend/app/whatsapp/[id]/edit/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/whatsapp/[id]/edit/page.tsx rename to apps/bridge-frontend/app/whatsapp/[id]/edit/page.tsx diff --git a/apps/metamigo-frontend/app/whatsapp/[id]/page.tsx b/apps/bridge-frontend/app/whatsapp/[id]/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/whatsapp/[id]/page.tsx rename to apps/bridge-frontend/app/whatsapp/[id]/page.tsx diff --git a/apps/metamigo-frontend/app/whatsapp/new/page.tsx b/apps/bridge-frontend/app/whatsapp/new/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/whatsapp/new/page.tsx rename to apps/bridge-frontend/app/whatsapp/new/page.tsx diff --git a/apps/metamigo-frontend/app/whatsapp/page.tsx b/apps/bridge-frontend/app/whatsapp/page.tsx similarity index 100% rename from apps/metamigo-frontend/app/whatsapp/page.tsx rename to apps/bridge-frontend/app/whatsapp/page.tsx diff --git a/apps/metamigo-frontend/next.config.mjs b/apps/bridge-frontend/next.config.mjs similarity index 100% rename from apps/metamigo-frontend/next.config.mjs rename to apps/bridge-frontend/next.config.mjs diff --git a/apps/metamigo-frontend/package.json b/apps/bridge-frontend/package.json similarity index 79% rename from apps/metamigo-frontend/package.json rename to apps/bridge-frontend/package.json index 6eb8a15..59469ab 100644 --- a/apps/metamigo-frontend/package.json +++ b/apps/bridge-frontend/package.json @@ -1,5 +1,5 @@ { - "name": "metamigo-frontend", + "name": "bridge-frontend", "version": "0.1.0", "private": true, "scripts": { @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@auth/kysely-adapter": "^0.7.0", + "@auth/kysely-adapter": "^1.0.0", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", @@ -17,14 +17,14 @@ "@mui/lab": "^5.0.0-alpha.170", "@mui/material": "^5", "@mui/material-nextjs": "^5.15.11", - "@mui/x-data-grid-pro": "^7.1.1", - "@mui/x-date-pickers-pro": "^7.1.1", - "@mui/x-license": "^7.1.1", + "@mui/x-data-grid-pro": "^7.3.0", + "@mui/x-date-pickers-pro": "^7.2.0", + "@mui/x-license": "^7.2.0", "date-fns": "^3.6.0", "kysely": "^0.26.1", "material-ui-popup-state": "^5.1.0", "mui-chips-input": "^2.1.4", - "next": "14.1.4", + "next": "14.2.2", "next-auth": "^4.24.7", "pg": "^8.11.5", "react": "18.2.0", @@ -41,8 +41,8 @@ "@types/pg": "^8.11.5", "@types/react": "^18", "@types/react-dom": "^18", - "eslint": "^9", - "eslint-config-next": "14.1.4", + "eslint": "^8", + "eslint-config-next": "14.2.2", "ts-config": "*", "typescript": "^5" } diff --git a/apps/metamigo-frontend/public/link-logo-small.png b/apps/bridge-frontend/public/link-logo-small.png similarity index 100% rename from apps/metamigo-frontend/public/link-logo-small.png rename to apps/bridge-frontend/public/link-logo-small.png diff --git a/apps/metamigo-frontend/tsconfig.json b/apps/bridge-frontend/tsconfig.json similarity index 100% rename from apps/metamigo-frontend/tsconfig.json rename to apps/bridge-frontend/tsconfig.json diff --git a/apps/metamigo-worker/.dockerignore b/apps/bridge-worker/.dockerignore similarity index 100% rename from apps/metamigo-worker/.dockerignore rename to apps/bridge-worker/.dockerignore diff --git a/apps/metamigo-worker/.eslintrc.js b/apps/bridge-worker/.eslintrc.js similarity index 100% rename from apps/metamigo-worker/.eslintrc.js rename to apps/bridge-worker/.eslintrc.js diff --git a/apps/bridge-worker/babel.config.json b/apps/bridge-worker/babel.config.json new file mode 100644 index 0000000..c53a6c5 --- /dev/null +++ b/apps/bridge-worker/babel.config.json @@ -0,0 +1,3 @@ +{ + "presets": ["@digiresilience/babel-preset-bridge"] +} diff --git a/apps/metamigo-worker/common.ts b/apps/bridge-worker/common.ts similarity index 92% rename from apps/metamigo-worker/common.ts rename to apps/bridge-worker/common.ts index 3a9dd89..5f8df88 100644 --- a/apps/metamigo-worker/common.ts +++ b/apps/bridge-worker/common.ts @@ -1,16 +1,16 @@ /* eslint-disable camelcase */ -import { SavedVoiceProvider } from "@digiresilience/metamigo-db"; +import { SavedVoiceProvider } from "@digiresilience/bridge-db"; import Twilio from "twilio"; import { CallInstance } from "twilio/lib/rest/api/v2010/account/call"; import { Zammad, getOrCreateUser } from "./zammad"; export const twilioClientFor = ( - provider: SavedVoiceProvider + provider: SavedVoiceProvider, ): Twilio.Twilio => { const { accountSid, apiKeySid, apiKeySecret } = provider.credentials; if (!accountSid || !apiKeySid || !apiKeySecret) throw new Error( - `twilio provider ${provider.name} does not have credentials` + `twilio provider ${provider.name} does not have credentials`, ); return Twilio(apiKeySid, apiKeySecret, { @@ -20,7 +20,7 @@ export const twilioClientFor = ( export const createZammadTicket = async ( call: CallInstance, - mp3: Buffer + mp3: Buffer, ): Promise => { const title = `Call from ${call.fromFormatted} at ${call.startTime}`; const body = `