Remove email from invites

This commit is contained in:
jableader 2025-11-05 20:27:59 +11:00
parent 3782477dda
commit 3e4e4fc2ae
2 changed files with 5 additions and 11 deletions

View file

@ -85,10 +85,6 @@ async def list_members(
# Invitations # Invitations
class CreateInvitationBody(ApiModel):
email: str
class InvitationResponse(ApiModel): class InvitationResponse(ApiModel):
token: str token: str
status: str = "pending" status: str = "pending"
@ -102,7 +98,6 @@ class InviteLinkResponse(ApiModel):
@scoped.post("/invitations", response_model=InviteLinkResponse) @scoped.post("/invitations", response_model=InviteLinkResponse)
async def create_invitation( async def create_invitation(
request: Request, request: Request,
body: CreateInvitationBody,
user: User = Depends(get_current_user), user: User = Depends(get_current_user),
household=Depends(get_household_from_slug), household=Depends(get_household_from_slug),
conn: aiosqlite.Connection = Depends(get_db), conn: aiosqlite.Connection = Depends(get_db),
@ -116,7 +111,7 @@ async def create_invitation(
expires_at = (datetime.utcnow() + timedelta(days=14)).isoformat() + "Z" expires_at = (datetime.utcnow() + timedelta(days=14)).isoformat() + "Z"
success = await households_repo.create_invitation( 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: if not success:

View file

@ -35,7 +35,6 @@ async def create(conn):
CREATE TABLE IF NOT EXISTS HouseholdInvitation ( CREATE TABLE IF NOT EXISTS HouseholdInvitation (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
household_id INTEGER NOT NULL, household_id INTEGER NOT NULL,
email TEXT NOT NULL,
invited_by_user_id INTEGER NOT NULL, invited_by_user_id INTEGER NOT NULL,
token TEXT NOT NULL UNIQUE, token TEXT NOT NULL UNIQUE,
expires_at DATETIME NOT NULL, expires_at DATETIME NOT NULL,
@ -136,15 +135,15 @@ async def list_members(conn, household_id: int) -> List[HouseholdMember]:
async def create_invitation( 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: ) -> bool:
try: try:
await conn.execute( await conn.execute(
""" """
INSERT INTO HouseholdInvitation (household_id, email, invited_by_user_id, token, expires_at, status) INSERT INTO HouseholdInvitation (household_id, invited_by_user_id, token, expires_at, status)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
""", """,
(household_id, email, invited_by_user_id, token, expires_at, "pending"), (household_id, invited_by_user_id, token, expires_at, "pending"),
) )
return True return True
except Exception: except Exception: