Skip to content

Commit

Permalink
feat: 임시 로그인 시간 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
viaunixue committed Jul 26, 2024
1 parent f201b9a commit 62d7ce9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Settings(BaseSettings):
MYSQL_DB : str

# 슬라이딩 윈도우 메시지 제한 설정
SLIDING_WINDOW_SIZE : int
MAX_SLIDING_WINDOW_SIZE : int

#퀴즈 제한 설정
QUIZ_COUNT : int
Expand Down
9 changes: 7 additions & 2 deletions app/repository/user_repository.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select
from datetime import datetime

from app.models.user import User
from sqlalchemy.future import select

class UserRepository:
def __init__(self, db: AsyncSession):
self.db = db

# 임시 로그인 유저 저장
async def create_user(self, name: str) -> User:
user = User(name=name)
user = User(
name=name,
created_at=datetime.now(),
updated_at=datetime.now()
)
self.db.add(user)
await self.db.commit()
await self.db.refresh(user)
Expand Down
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def custom_generate_unique_id(route: APIRoute) -> str:
async def app_lifespan(app: FastAPI):
# 애플리케이션 시작 시 실행될 로직
async with engine.begin() as conn:
# 모든 테이블 삭제
# await conn.run_sync(Base.metadata.drop_all)
# 모든 테이블 다시 생성
await conn.run_sync(Base.metadata.create_all)
yield
# 애플리케이션 종료 시 실행될 로직 (필요한 경우)
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ greenlet
python-dotenv
alembic
pytest
cryptography
cryptography
mysqlclient
alembic

0 comments on commit 62d7ce9

Please sign in to comment.