From 3e4e4fc2aeb23d94f69fba1d02a459a754f93d1a Mon Sep 17 00:00:00 2001 From: jableader Date: Wed, 5 Nov 2025 20:27:59 +1100 Subject: [PATCH] Remove email from invites --- api/households.py | 7 +------ households/repository.py | 9 ++++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/api/households.py b/api/households.py index 8760dce..2ab37b8 100644 --- a/api/households.py +++ b/api/households.py @@ -85,10 +85,6 @@ async def list_members( # Invitations -class CreateInvitationBody(ApiModel): - email: str - - class InvitationResponse(ApiModel): token: str status: str = "pending" @@ -102,7 +98,6 @@ class InviteLinkResponse(ApiModel): @scoped.post("/invitations", response_model=InviteLinkResponse) async def create_invitation( request: Request, - body: CreateInvitationBody, user: User = Depends(get_current_user), household=Depends(get_household_from_slug), conn: aiosqlite.Connection = Depends(get_db), @@ -116,7 +111,7 @@ async def create_invitation( expires_at = (datetime.utcnow() + timedelta(days=14)).isoformat() + "Z" success = await households_repo.create_invitation( - conn, household["id"], body.email, user.id, token, expires_at + conn, household["id"], user.id, token, expires_at ) if not success: diff --git a/households/repository.py b/households/repository.py index ae4e98d..dadbd06 100644 --- a/households/repository.py +++ b/households/repository.py @@ -35,7 +35,6 @@ async def create(conn): CREATE TABLE IF NOT EXISTS HouseholdInvitation ( id INTEGER PRIMARY KEY, household_id INTEGER NOT NULL, - email TEXT NOT NULL, invited_by_user_id INTEGER NOT NULL, token TEXT NOT NULL UNIQUE, expires_at DATETIME NOT NULL, @@ -136,15 +135,15 @@ async def list_members(conn, household_id: int) -> List[HouseholdMember]: async def create_invitation( - conn, household_id: int, email: str, invited_by_user_id: int, token: str, expires_at: str + conn, household_id: int, invited_by_user_id: int, token: str, expires_at: str ) -> bool: try: await conn.execute( """ - INSERT INTO HouseholdInvitation (household_id, email, invited_by_user_id, token, expires_at, status) - VALUES (?, ?, ?, ?, ?, ?) + INSERT INTO HouseholdInvitation (household_id, invited_by_user_id, token, expires_at, status) + VALUES (?, ?, ?, ?, ?) """, - (household_id, email, invited_by_user_id, token, expires_at, "pending"), + (household_id, invited_by_user_id, token, expires_at, "pending"), ) return True except Exception: