Skip to content

[deploy] 운영자 이메일 검토 api 기능 및 이슈 핀 등록 및 수정 api 이미지 갯수 제한 기능 배포#133

Merged
selnem merged 6 commits into
prodfrom
develop
Jun 16, 2026
Merged

[deploy] 운영자 이메일 검토 api 기능 및 이슈 핀 등록 및 수정 api 이미지 갯수 제한 기능 배포#133
selnem merged 6 commits into
prodfrom
develop

Conversation

@selnem

@selnem selnem commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

[deploy] 운영자 이메일 검토 api 기능 및 이슈 핀 등록 및 수정 api 이미지 1개 이상으로 제한 배포

@selnem selnem self-assigned this Jun 16, 2026
@selnem selnem added the 🚀 deploy 배포 label Jun 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces administrative endpoints and schemas to list and retrieve complaint petitions for review, along with enforcing a requirement that issue pins must have at least one image when created or updated. Unit tests have been added to verify these new features. The reviewer feedback highlights two key areas for improvement in ComplaintPetitionService.py: first, avoiding a potential lazy loading error (MissingGreenlet) and performance overhead in create_petition_for_issue_pin by constructing the response directly instead of using _to_review_item; second, adding a defensive null check for petition.generated_on in _to_review_item to prevent potential AttributeErrors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread app/services/ComplaintPetitionService.py Outdated
location_id=location_id,
department_name=department_name,
location_department_email=location_department_email,
generated_on=petition.generated_on.isoformat(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In _build_pretty_attachment_filename, petition.generated_on is handled defensively with a null check (petition.generated_on.isoformat() if petition.generated_on else "unknown-date"). However, here in _to_review_item, petition.generated_on.isoformat() is called directly without a null check.

To prevent potential AttributeError if generated_on is ever None (e.g., in legacy data or test fixtures), please add a defensive null check here as well.

Suggested change
generated_on=petition.generated_on.isoformat(),
generated_on=petition.generated_on.isoformat() if petition.generated_on is not None else "",

@selnem

selnem commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces features for reviewing complaint petitions and enforces a requirement that issue pins must have at least one image. Specifically, it adds admin endpoints to list and retrieve complaint petitions, updates schemas and OpenAPI descriptions, and implements validation logic in the issue service to prevent creating or updating pins without images. Unit tests have also been added to verify these changes. The review feedback suggests two key improvements: first, implementing defensive fallback values when mapping database records to Pydantic schemas to avoid potential validation errors on null fields; second, optimizing SQLAlchemy eager loading by chaining nested selectinload options under a single relationship.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread app/services/ComplaintPetitionService.py
Comment on lines +20 to +26
@staticmethod
def _review_load_options():
return (
selectinload(ComplaintPetition.location_department).selectinload(LocationDepartment.department),
selectinload(ComplaintPetition.location_department).selectinload(LocationDepartment.location),
selectinload(ComplaintPetition.issue_pin).selectinload(IssuePin.pin),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

동일한 관계(location_department)에 대해 여러 중첩 관계(department, location)를 로드할 때, selectinload를 각각 따로 호출하는 대신 options() 메서드를 사용하여 체이닝하는 것이 SQLAlchemy에서 더 명확하고 효율적입니다. 이렇게 하면 중복된 로더 옵션 정의를 방지할 수 있습니다.

    @staticmethod\n    def _review_load_options():\n        return (\n            selectinload(ComplaintPetition.location_department).options(\n                selectinload(LocationDepartment.department),\n                selectinload(LocationDepartment.location),\n            ),\n            selectinload(ComplaintPetition.issue_pin).selectinload(IssuePin.pin),\n        )

@selnem selnem merged commit bfd3eaa into prod Jun 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant