-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 정책 핀 sync·배치 가공·DB 적재 파이프라인 및 관리자 API 추가 #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
52142b7
feat: 정책 핀 sync·배치 가공·DB 적재 파이프라인 및 관리자 API 추가
selnem 1a29a06
fix: 정책 핀 파이프라인 코드리뷰 지적 4건 반영
selnem 6eec2df
fix: import_handoff_batch 메타데이터 오타 수정 및 정책 파이프라인 테스트 추가
selnem dc70187
fix: 정책 핀 sync 날짜 검증·handoff 적재 drain·모델 unique 동기화
selnem 89e4707
fix: 정책 관리자 API 리뷰 지적 보완
selnem 1b97e63
fix: 정책 관리자 리뷰 후속 지적 반영
selnem f1fc0a3
fix: 정책 파이프라인 N+1 쿼리·동기 I/O 리뷰 반영
selnem 5f4bade
fix: 정책 sync 루프·handoff 비어 있을 때 DB 완료 상태 인식
selnem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from sqlalchemy import BigInteger, ForeignKey, Identity, String | ||
| from sqlalchemy.orm import Mapped, mapped_column, relationship | ||
|
|
||
| from app.core.database import Base | ||
| from app.models.Community import Community | ||
|
|
||
|
|
||
| class CardnewsImageS3(Base): | ||
| __tablename__ = "cardnews_image_s3" | ||
|
|
||
| cardnews_image_s3_id: Mapped[int] = mapped_column( | ||
| "cardnews_image_s3_id", | ||
| BigInteger, | ||
| Identity(), | ||
| primary_key=True, | ||
| ) | ||
| community_id: Mapped[int] = mapped_column( | ||
| "community_id", | ||
| BigInteger, | ||
| ForeignKey("community.community_id"), | ||
| nullable=False, | ||
| ) | ||
| community: Mapped[Community] = relationship( | ||
| "Community", | ||
| foreign_keys=[community_id], | ||
| back_populates="cardnews_images", | ||
| lazy="selectin", | ||
| ) | ||
| cardnews_image_s3_key: Mapped[str] = mapped_column( | ||
| "cardnews_image_s3_key", | ||
| String(500), | ||
| nullable=False, | ||
| ) | ||
| cardnews_image_s3_url: Mapped[str] = mapped_column( | ||
| "cardnews_image_s3_url", | ||
| String(500), | ||
| nullable=False, | ||
| ) |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from sqlalchemy import delete, select | ||
| from sqlalchemy.ext.asyncio import AsyncSession | ||
|
|
||
| from app.models.CardnewsImageS3 import CardnewsImageS3 | ||
| from app.repositories.BaseRepo import BaseRepo | ||
|
|
||
|
|
||
| class CardnewsImageS3Repo(BaseRepo[CardnewsImageS3]): | ||
| def __init__(self, session: AsyncSession) -> None: | ||
| super().__init__(session, CardnewsImageS3) | ||
|
|
||
| async def list_by_community_id(self, community_id: int) -> list[CardnewsImageS3]: | ||
| result = await self.session.execute( | ||
| select(CardnewsImageS3) | ||
| .where(CardnewsImageS3.community_id == community_id) | ||
| .order_by(CardnewsImageS3.cardnews_image_s3_id.asc()), | ||
| ) | ||
| return list(result.scalars().all()) | ||
|
|
||
| async def delete_by_community_id(self, community_id: int) -> int: | ||
| result = await self.session.execute( | ||
| delete(CardnewsImageS3).where(CardnewsImageS3.community_id == community_id), | ||
| ) | ||
| await self.session.flush() | ||
| return int(result.rowcount or 0) |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
설정 필드
policy_admin_user_name에서POLICY_ADMIN_NICKNAME을 별칭(alias)으로 허용하고 있지만,PolicyEventIngestService.resolve_admin_uid에서는 이 값을 항상user_name컬럼 기준으로만 조회(get_by_user_name)하고 있습니다. 만약 사용자가POLICY_ADMIN_NICKNAME환경 변수를 설정할 경우, 실제 DB의nickname컬럼이 아닌user_name컬럼에서 조회되어 사용자를 찾지 못하는 런타임 오류가 발생할 수 있습니다. 별칭에서POLICY_ADMIN_NICKNAME을 제거하거나, 조회 시 닉네임과 유저명을 모두 고려하도록 로직을 수정하는 것이 안전합니다.