♻️ auth 패키지 구현체 및 DI 도입, email 패키지 분리#42
Merged
Merged
Conversation
Yeonu-Kim
commented
Jun 22, 2026
Comment on lines
+11
to
+12
| if TYPE_CHECKING: | ||
| from app.models.deposit import Deposit |
Collaborator
Author
There was a problem hiding this comment.
deposit 안 쓰니까 제거해야 됨
-> 별도 issue로 뽑아두기
Comment on lines
+35
to
+61
| class EmailVerificationRepositoryImpl(EmailVerificationRepository): | ||
| def __init__(self, db: AsyncSession) -> None: | ||
| self.db = db | ||
|
|
||
| async def save(self, verification: EmailVerification) -> None: | ||
| self.db.add(verification) | ||
| await self.db.commit() | ||
|
|
||
| async def find_latest_unverified( | ||
| self, email: str, code: str | ||
| ) -> EmailVerification | None: | ||
| return cast( | ||
| EmailVerification | None, | ||
| await self.db.scalar( | ||
| select(EmailVerification) | ||
| .where( | ||
| EmailVerification.email == email, | ||
| EmailVerification.code == code, | ||
| EmailVerification.is_verified.is_(False), | ||
| EmailVerification.expires_at > datetime.now(UTC), | ||
| ) | ||
| .order_by(EmailVerification.created_at.desc()) | ||
| ), | ||
| ) | ||
|
|
||
| async def update(self, verification: EmailVerification) -> None: | ||
| await self.db.commit() |
Collaborator
Author
There was a problem hiding this comment.
인증코드 저장 로직은 별도 repo로 분리 (User 생성하는 거랑 로직상으로 차이가 있음. 한방에 묶어서 관리하기보다는 별도로 분리했을 때 추후 디버깅할 때 여기만 보면 되니까 유리할 듯
Comment on lines
+4
to
+18
| class EmailSender(ABC): | ||
| @abstractmethod | ||
| async def send_verification(self, to: str, code: str) -> None: ... | ||
|
|
||
| @abstractmethod | ||
| async def send_temp_password(self, to: str, temp_password: str) -> None: ... | ||
|
|
||
| @abstractmethod | ||
| async def send_reward( | ||
| self, | ||
| to: str, | ||
| event_title: str, | ||
| reward_wei: int, | ||
| wallet_balance_wei: int, | ||
| ) -> None: ... |
Collaborator
Author
There was a problem hiding this comment.
email-service에서는 정말 전송만 담당함.
Collaborator
Author
There was a problem hiding this comment.
send-reward도 사실 여기에 들어가는 게 아니라 blokchain 관련 패키지에서 메세지를 제공하는 대로 전송하는 게 맞지 않을까?
-> 수정해서 커밋 완료
| created_at: Mapped[datetime] = mapped_column( | ||
| DateTime(timezone=True), server_default=func.now() | ||
| ) | ||
| from app.auth.models import EmailVerification as EmailVerification # noqa: F401 |
Collaborator
Author
There was a problem hiding this comment.
다른 파일 때문에 임시로 이렇게 불필요한 코드를 넣어둠. 리팩토링 완료하면 삭제해도 됨.
|
|
||
| from app.core.config import settings | ||
| from app.core.email import send_reward_email | ||
| from app.email.service_impl import send_reward_email |
Collaborator
Author
There was a problem hiding this comment.
원래는 안되는데 blochain 부분이 리팩토링 전이라 일단 보류
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.