mmday-firebase/package.json
윤정민 eb44f50886 Index user votes by date for daily archive
- /userVotesByDate/{date}/{uid}/{gameId} fan-out 인덱스 추가 — RTDB에는 부분 노드 읽기가 없어서 dailyArchive가 하루치를 처리하려면 /userVotes 트리 전체(전 유저 x 전 보존 날짜)를 내려받아야 했다
- 투표를 쓰는 3곳(submitVote, changeVote, processGameEndWithGame의 판정 결과 주입)이 원자 update 하나로 원본과 미러를 함께 기록
- 삭제 경로도 동기화: deleteUserVoteGame은 양쪽에서, deleteUserVoteIndex는 유저의 날짜 목록을 먼저 읽어 해당 날짜 미러만 정리
- database.rules.json에 userVotesByDate·userVotesByDateMeta를 read/write false로 추가 — 교차 유저 데이터라 서버 전용
- 백필 스크립트 추가(npm run backfill:vote-index). dry-run 기본, --apply로 500건씩 청킹 기록, 멱등. 완료 시 /userVotesByDateMeta/backfilledAt 마커를 남겨 잡이 원본 스캔을 그만두는 근거로 쓴다
- 미러 정합성 테스트 8건 추가
2026-07-27 13:26:15 +09:00

43 lines
1.4 KiB
JSON

{
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"build:watch": "tsc --watch",
"serve": "npm run build && firebase emulators:start --only auth,functions,firestore,database,storage",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"test": "firebase emulators:exec --only firestore,database,auth \"vitest run\"",
"test:watch": "vitest",
"tools:sheet": "npx tsx scripts/chat-tools-sheet.ts",
"seed:rewards": "npx tsx scripts/seed-reward-products.ts",
"upload:reward-assets": "npx tsx scripts/upload-reward-product-assets.ts",
"optimize:reward-images": "npx tsx scripts/optimize-reward-product-images.ts",
"backfill:vote-index": "npx tsx scripts/backfill-user-votes-by-date.ts"
},
"engines": {
"node": "24"
},
"main": "lib/index.js",
"dependencies": {
"@anthropic-ai/sdk": "^0.104.1",
"@google/genai": "^2.8.0",
"firebase-admin": "^13.6.0",
"firebase-functions": "^7.0.0",
"sharp": "^0.35.3"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.25.4",
"firebase-functions-test": "^3.4.1",
"typescript": "^5.7.3",
"vitest": "^4.1.4"
},
"private": true
}