feat: 임시멤버(명부) 일괄 생성 엔드포인트 POST /users/temporary#11
Open
youngunghan wants to merge 4 commits into
Open
Conversation
1c01c44 to
e62f061
Compare
Admin bulk-creates temporary members from a JSON roster (name, student_id). People not already in the DB become temp members, matched/deduped by student_id (idempotent: already_exists / duplicate_in_request). - users.email -> nullable, new is_temporary column + indexes (alembic a1b2c3d4e5f6) - Enforce "temp member != real member": excluded from /users/pending, and blocked from /approve and from project membership (400 guards) - Input normalization (strip whitespace / zero-width / BOM), roster max 2000, admin-only - Tests: tests/test_temp_members.py (20 cases)
e62f061 to
9126e3e
Compare
Team decision: the frontend uploads the raw .xlsx and the backend parses it, instead of the frontend parsing to JSON. - POST /users/temporary now accepts an .xlsx UploadFile (multipart) instead of JSON - app/services/roster.py: header-based column detection (name/student_id, Korean/English aliases, column-order agnostic); rows validated via TempMemberInput - Blank/malformed rows are skipped as "invalid" (not a whole-file 422) - New errors: INVALID_ROSTER_FILE (400), EMPTY_ROSTER (422), ROSTER_TOO_LARGE (400) - Add openpyxl; tests rewritten to upload in-memory .xlsx
- Detect file type by extension (.xlsx / .csv); reject others as
"파일 양식이 올바르지 않습니다."
- Per-column header errors ("이름/학번 헤더를 찾을 수 없습니다.")
- Per-record missing-field skip with reason + Korean message
(missing_name / missing_student_id)
- SkippedMember gains a `message` field; route maps reason to message
- Drop the now-unused TempMemberInput schema (logic moved to roster.py)
swfs0417
reviewed
Jul 7, 2026
| db, | ||
| [(m.name, m.student_id) for m in request.members], | ||
| ) | ||
| content = await file.read() |
Collaborator
There was a problem hiding this comment.
현재 row 크기 말고는 입력 크기 제한이 없는데, 용량 기준으로도 제한하는 게 좋을 것 같습니다.
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.
DONE
신규 API — 회원 명부 파일 업로드 → 임시멤버 일괄 생성
POST /users/temporary (admin, multipart/form-data, field
file)· 잘못된 파일 → "파일 양식이 올바르지 않습니다."
· 헤더 누락 → "이름 헤더를 찾을 수 없습니다." / "학번 헤더를 찾을 수 없습니다."
· record 필드 누락 → "김와플"의 학번을 찾을 수 없습니다. (해당 행만 skip + 보고)
결정 (FE 확인 필요)