From 5599b3042a09b9581810e2dae1ab345352fe8c4d Mon Sep 17 00:00:00 2001 From: Nik Graf Date: Sat, 16 Nov 2024 16:00:43 +0100 Subject: [PATCH 1/2] add accept-invitation --- .../src/components/debug-invitations.tsx | 9 ++- apps/events/src/routes/playground.tsx | 24 ++++++- .../migration.sql | 24 +++++++ apps/server/prisma/schema.prisma | 15 +++-- apps/server/src/handlers/applySpaceEvent.ts | 28 +++++++-- apps/server/src/handlers/listInvitations.ts | 2 +- apps/server/src/index.ts | 13 +++- .../src/accept-invitation.test.ts | 60 ++++++++++++++++++ .../src/accept-invitation.ts | 30 +++++++++ .../src/apply-event.ts | 63 ++++++++++++++----- .../src/create-invitation.test.ts | 45 ++++++++++++- .../src/create-invitation.ts | 4 +- .../src/create-space.ts | 4 +- .../src/delete-space.test.ts | 57 ++++++++++++++--- .../graph-framework-space-events/src/index.ts | 1 + .../graph-framework-space-events/src/types.ts | 21 ++++++- 16 files changed, 355 insertions(+), 45 deletions(-) create mode 100644 apps/server/prisma/migrations/20241116161206_extend_invitation/migration.sql create mode 100644 packages/graph-framework-space-events/src/accept-invitation.test.ts create mode 100644 packages/graph-framework-space-events/src/accept-invitation.ts diff --git a/apps/events/src/components/debug-invitations.tsx b/apps/events/src/components/debug-invitations.tsx index d940c611..8b262315 100644 --- a/apps/events/src/components/debug-invitations.tsx +++ b/apps/events/src/components/debug-invitations.tsx @@ -1,7 +1,12 @@ import type { Invitation } from 'graph-framework'; import { Button } from './ui/button'; -export function DebugInvitations({ invitations }: { invitations: Invitation[] }) { +type Props = { + invitations: Invitation[]; + accept: (invitation: Invitation) => void; +}; + +export function DebugInvitations({ invitations, accept }: Props) { return (