From 674e5aafecc0b23ce6a500ec38ac57c38a444325 Mon Sep 17 00:00:00 2001 From: "M. E. Abdelsalam" Date: Tue, 24 Dec 2024 22:17:18 +0200 Subject: [PATCH] refactor: calls table and corresponding tables have been dropped; call is replaced with session_id. --- apps/nova/src/components/Call/GhostView.tsx | 2 +- .../src/components/Interviews/Interview.tsx | 2 +- apps/nova/src/components/Lessons/Lesson.tsx | 2 +- .../PendingInterview/index.tsx | 10 +- .../Interview/ScheduledInterview/index.tsx | 10 +- apps/nova/src/hooks/call.ts | 16 +- apps/nova/src/pages/Call.tsx | 38 +-- packages/atlas/src/atlas.ts | 6 +- packages/atlas/src/call.ts | 19 -- packages/atlas/src/chat.ts | 4 +- packages/atlas/src/session.ts | 12 + packages/auth/src/middleware.ts | 5 +- packages/headless/package.json | 4 +- .../headless/src/{calls.ts => sessions.ts} | 132 ++++---- packages/models/fixtures/db.ts | 14 +- .../models/migrations/1716146586880_setup.js | 50 +-- packages/models/scripts/seed.ts | 23 +- packages/models/src/cache/call.ts | 68 ---- packages/models/src/cache/index.ts | 6 +- packages/models/src/cache/peer.ts | 16 +- packages/models/src/cache/session.ts | 70 ++++ packages/models/src/calls.ts | 303 ------------------ packages/models/src/index.ts | 1 - packages/models/src/interviews.ts | 55 +++- packages/models/src/lessons.ts | 68 ++-- packages/models/src/lib/utils.ts | 12 + packages/models/tests/cache/call.test.ts | 62 ---- packages/models/tests/cache/peer.test.ts | 20 +- packages/models/tests/cache/session.test.ts | 69 ++++ packages/models/tests/calls.test.ts | 137 -------- packages/models/tests/lessons.test.ts | 2 +- packages/sol/package.json | 4 + packages/sol/src/ghost.ts | 8 +- packages/sol/src/index.ts | 1 + packages/sol/src/session.ts | 12 + packages/types/src/api.ts | 2 +- packages/types/src/call.ts | 79 ----- packages/types/src/index.ts | 2 +- packages/types/src/interview.ts | 19 +- packages/types/src/lesson.ts | 8 +- packages/types/src/peer.ts | 6 +- packages/types/src/room.ts | 2 +- packages/types/src/session.ts | 37 +++ packages/types/src/user.ts | 2 +- packages/types/src/wss.ts | 32 +- services/server/fixtures/db.ts | 13 +- services/server/fixtures/shared.ts | 3 - services/server/fixtures/wss.ts | 10 +- services/server/src/handlers/call.ts | 67 ---- services/server/src/handlers/chat.ts | 27 +- services/server/src/handlers/interview.ts | 9 +- services/server/src/handlers/invoice.ts | 2 - services/server/src/handlers/lesson.ts | 9 +- services/server/src/handlers/peer.ts | 22 +- services/server/src/handlers/session.ts | 67 ++++ services/server/src/index.ts | 2 +- services/server/src/lib/error.ts | 2 +- .../server/src/lib/{call.ts => session.ts} | 22 +- services/server/src/lib/utils.ts | 5 - .../server/src/middleware/accessControl.ts | 6 +- services/server/src/routes/call.ts | 9 - services/server/src/routes/chat.ts | 2 +- services/server/src/routes/index.ts | 4 +- services/server/src/routes/session.ts | 9 + services/server/src/validation/utils.ts | 2 + services/server/src/wss/handlers/call.ts | 104 ------ .../server/src/wss/handlers/connection.ts | 36 ++- services/server/src/wss/handlers/index.ts | 6 +- .../server/src/wss/handlers/inputDevices.ts | 16 +- services/server/src/wss/handlers/peer.ts | 24 +- services/server/src/wss/handlers/session.ts | 100 ++++++ services/server/src/wss/utils.ts | 4 +- services/server/tests/api/call.test.ts | 66 ---- services/server/tests/api/user.test.ts | 3 +- services/server/tests/wss/call.test.ts | 24 +- 75 files changed, 804 insertions(+), 1323 deletions(-) delete mode 100644 packages/atlas/src/call.ts create mode 100644 packages/atlas/src/session.ts rename packages/headless/src/{calls.ts => sessions.ts} (90%) delete mode 100644 packages/models/src/cache/call.ts create mode 100644 packages/models/src/cache/session.ts delete mode 100644 packages/models/src/calls.ts create mode 100644 packages/models/src/lib/utils.ts delete mode 100644 packages/models/tests/cache/call.test.ts create mode 100644 packages/models/tests/cache/session.test.ts delete mode 100644 packages/models/tests/calls.test.ts create mode 100644 packages/sol/src/session.ts delete mode 100644 packages/types/src/call.ts create mode 100644 packages/types/src/session.ts delete mode 100644 services/server/src/handlers/call.ts create mode 100644 services/server/src/handlers/session.ts rename services/server/src/lib/{call.ts => session.ts} (83%) delete mode 100644 services/server/src/lib/utils.ts delete mode 100644 services/server/src/routes/call.ts create mode 100644 services/server/src/routes/session.ts delete mode 100644 services/server/src/wss/handlers/call.ts create mode 100644 services/server/src/wss/handlers/session.ts delete mode 100644 services/server/tests/api/call.test.ts diff --git a/apps/nova/src/components/Call/GhostView.tsx b/apps/nova/src/components/Call/GhostView.tsx index 292edb45..5b5b1ef7 100644 --- a/apps/nova/src/components/Call/GhostView.tsx +++ b/apps/nova/src/components/Call/GhostView.tsx @@ -1,6 +1,6 @@ import { useFormatMessage } from "@litespace/luna/hooks/intl"; import { Typography } from "@litespace/luna/Typography"; -import { RemoteStream } from "@litespace/headless/calls"; +import { RemoteStream } from "@litespace/headless/sessions"; import { isEmpty } from "lodash"; import React from "react"; import UserMedia from "@/components/Call/UserMedia"; diff --git a/apps/nova/src/components/Interviews/Interview.tsx b/apps/nova/src/components/Interviews/Interview.tsx index f9382a42..d72077f9 100644 --- a/apps/nova/src/components/Interviews/Interview.tsx +++ b/apps/nova/src/components/Interviews/Interview.tsx @@ -97,7 +97,7 @@ const Interview: React.FC<{
{upcoming ? ( - +