feat(api+testing): update member password and email verfied

This commit is contained in:
2024-03-02 16:18:32 -05:00
parent b53761a4dd
commit 1a6469efa5
2 changed files with 71 additions and 0 deletions

View File

@@ -86,3 +86,44 @@ async def insert_member(
member = await curr.fetchone()
return None if member is None else member
async def update_member_password(
db: AsyncConnectionPool, id: int, password_hash: str
) -> bool:
async with db.connection() as conn:
async with conn.cursor(row_factory=class_row(Member)) as curr:
query = sql.SQL(
"""
UPDATE members
SET password_hash = (%s)
WHERE id = (%s)
"""
)
await curr.execute(
query,
(
password_hash,
id,
),
)
return curr.rowcount > 0
async def update_member_email_verified(db: AsyncConnectionPool, id: int) -> bool:
async with db.connection() as conn:
async with conn.cursor(row_factory=class_row(Member)) as curr:
query = sql.SQL(
"""
UPDATE members SET email_verified = now() WHERE id = (%s)
"""
)
await curr.execute(
query,
(id,),
)
return curr.rowcount > 0