(
username: str,
)
| 6 | |
| 7 | |
| 8 | async def get_admin_by_username( |
| 9 | username: str, |
| 10 | ): |
| 11 | # 1. get from database |
| 12 | async with postgres_pool.get_db_connection() as conn: |
| 13 | row = await conn.fetchrow( |
| 14 | "SELECT * FROM app_admin WHERE username = $1", |
| 15 | username, |
| 16 | ) |
| 17 | |
| 18 | # 2. write to redis and return |
| 19 | if row: |
| 20 | admin = Admin.build(row) |
| 21 | return admin |
| 22 | |
| 23 | return None |
nothing calls this directly
no test coverage detected