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
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:

View file

@ -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: