작업 내용 저장

This commit is contained in:
2026-04-23 10:16:09 +00:00
parent d383c7086f
commit bc56c5c101
7 changed files with 307 additions and 1 deletions
+20
View File
@@ -564,6 +564,26 @@ class PostgresPortfolioRepository:
rows = cur.fetchall()
return [self._row_to_auth_token(row) for row in rows]
def list_service_tokens(
self,
user_id: str | None = None,
*,
include_revoked: bool = False,
) -> list[AuthToken]:
self.ensure_schema()
conditions = ["token_type = 'service'"]
params: list = []
if user_id is not None:
conditions.append("user_id = %s")
params.append(user_id)
if not include_revoked:
conditions.append("revoked_at IS NULL")
where = "WHERE " + " AND ".join(conditions) + " "
with self._connect().cursor() as cur:
cur.execute(_SELECT_AUTH_TOKEN + where + "ORDER BY created_at DESC, id ASC", params)
rows = cur.fetchall()
return [self._row_to_auth_token(row) for row in rows]
def revoke_auth_token(self, user_id: str, token_id: str) -> None:
self.ensure_schema()
with self._connect().cursor() as cur: