Add api auth to user stat repo (#805)

* added api_auth to user_stats_repository

* pre_commit changes

* Remove call with dev uuid

Co-authored-by: Andreas Köpf <andreas.koepf@xamla.com>
This commit is contained in:
dhug
2023-01-17 15:07:39 -05:00
committed by GitHub
parent 0f896d910e
commit 6b82b2cd13
@@ -4,6 +4,7 @@ from uuid import UUID
import sqlalchemy as sa
from loguru import logger
from oasst_backend.config import settings
from oasst_backend.models import Message, MessageReaction, Task, User, UserStats, UserStatsTimeFrame
from oasst_backend.models.db_payload import (
LabelAssistantReplyPayload,
@@ -291,13 +292,11 @@ WHERE
if __name__ == "__main__":
from oasst_backend.api.deps import get_dummy_api_client
from oasst_backend.api.deps import api_auth
from oasst_backend.database import engine
with Session(engine) as session:
api_client = get_dummy_api_client(session)
usr = UserStatsRepository(session)
# usr.update_all_time_frames()
# session.commit()
# usr.get_leader_board(UserStatsTimeFrame.total)
usr.get_user_stats_all_time_frames(UUID("0d6ff62a-0bea-4c56-ade8-b3e0520a10ce"))
with Session(engine) as db:
api_client = api_auth(settings.OFFICIAL_WEB_API_KEY, db=db)
usr = UserStatsRepository(db)
usr.update_all_time_frames()
db.commit()