Conversation
complaint_petition 목록·단건 조회 엔드포인트를 추가해
Refector/130 email imgcnt
There was a problem hiding this comment.
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.
| location_id=location_id, | ||
| department_name=department_name, | ||
| location_department_email=location_department_email, | ||
| generated_on=petition.generated_on.isoformat(), |
There was a problem hiding this comment.
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.
| generated_on=petition.generated_on.isoformat(), | |
| generated_on=petition.generated_on.isoformat() if petition.generated_on is not None else "", |
fix: 민원 생성 응답을 직접 구성해 lazy loading 위험 제거
|
/gemini review |
There was a problem hiding this comment.
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.
| @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), | ||
| ) |
There was a problem hiding this comment.
동일한 관계(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 )
[deploy] 운영자 이메일 검토 api 기능 및 이슈 핀 등록 및 수정 api 이미지 1개 이상으로 제한 배포