Repository navigation
Conversation
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.
🔗 연관된 이슈
🎯 의도
📝 작업 내용
📌 요약
api-v2에POST /api/goals/{goalId}/records/{recordId}/rollback추가🔍 상세
nestjs-api/src/development-recordsDevelopmentRecordsController: Firebase ID token의 UID만 사용하고 요청 본문의 다른 필드는 무시,goalId,recordId,sourceVersionId,expectedCurrentVersionId가 문자열이 아니거나 공백이거나/를 포함하면400invalid-argumentDevelopmentRecordsService: rollback 판정 함수를 한 곳에 두고 transaction 결과를 응답으로 변환DevelopmentRecordsRepository:users/{uid}/developmentGoals/{goalId}/records/{recordId}와 하위versions를 같은 transaction에서 읽고 조건 충족 시 version 생성과 기록 갱신changeKind == 'rollback'이고sourceVersionId가 요청 원본과 같으면 기존 version 반환expectedCurrentVersionId와 다름 → Draft 존재 → 원본versionNumber가 현재 번호 이상versionNumber는 현재 번호 + 1, 원본의title,markdownContent복사,changeKind: 'rollback',sourceVersionId저장randomUUID().toUpperCase(),confirmedAt은Timestamp.now()로 transaction 밖에서 한 번 생성해 Admin SDK 재실행에도 같은 값 유지currentVersionId,currentVersionNumber만 갱신하고 목표 문서는 읽지도 쓰지도 않음create외의 쓰기 없음id,recordId,number,title,markdownContent,kind,sourceVersionId,confirmedAt(ISO 8601 UTC 문자열)이고 새 생성과 재시도 모두200404not-found: 인증된 UID 경로에 기록 또는 원본 version 없음409development-record-rollback-needs-version: 현재 확정 version 없음409development-record-rollback-version-conflict: 기준 현재 version 문서가 없거나 현재 version이 기준과 다르고 같은 rollback도 아님409development-record-rollback-has-draft: 확정되지 않은 초안 존재409development-record-rollback-source-not-earlier: 원본 version이 현재 version보다 이전이 아님409aborted: 동시 변경으로 transaction 재시도 소진500internal: 현재 version 필드 쌍 불일치, 기록이 가리키는 version 문서 없음, version 필드 타입 오류 등 그 밖의 오류nestjs-api/src/app.module.tsDevelopmentRecordsModule등록nestjs-api/testdevelopment-records.e2e.test.ts: 인증, 경로·본문 식별자 검증, 본문uid무시, Service 오류 응답 전달development-records.emulator.test.ts: 정상 rollback 저장, 같은 rollback 재시도와 동시 요청의 단일 version 생성, 현재 version이 바뀐 이전 요청과 Draft 존재의 미변경, 다른 사용자 경로, 기존 확정 version 불변README.mdapi-v2책임과 emulator 검사 설명에 개발 기록 rollback 추가/api/goals/**Hosting rewrite가 새 경로를 이미 포함해firebase.json,firestore.rules,firestore.index.json변경 없음