Voting window decided: open D-2 (kickoff-48h), close at kickoff
- types/schedule: add opensAt (kickoff-48h), lockAt = kickoff (정각) - Arena: 3-state gating (곧 오픈 / 활성 / 예측 마감), DEMO_FORCE_OPEN flag - seed.mjs, BACKEND.md, 기능정의서: lock semantics = kickoff, opensAt added - error codes: MATCH_NOT_OPEN (422) before opensAt, MATCH_LOCKED (423) at kickoff Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b9dbd2276
commit
e43cc08429
7 files changed
+57
-23
No files matched your search
+5
-3
@@ -8,7 +8,8 @@ import { getFirestore, FieldValue } from "firebase-admin/firestore";
|
||||
initializeApp({ credential: applicationDefault() });
|
||||
const db = getFirestore();
|
||||
|
||||
const lock = (iso) => new Date(new Date(iso).getTime() - 10 * 60000).toISOString();
|
||||
// 투표 오픈 = 킥오프 -48h(D-2), 마감 = 킥오프 정각(경기 시작 전까지)
|
||||
const opens = (iso) => new Date(new Date(iso).getTime() - 48 * 3600000).toISOString();
|
||||
const T = {
|
||||
KOR: { name: "Korea Republic", shortName: "한국", code: "KOR", flag: "🇰🇷" },
|
||||
CZE: { name: "Czechia", shortName: "체코", code: "CZE", flag: "🇨🇿" },
|
||||
@@ -39,8 +40,9 @@ async function run() {
|
||||
for (const [matchId, round, a, b, kickoff, venue, hook] of MATCHES) {
|
||||
batch.set(db.collection("matches").doc(matchId), {
|
||||
matchId, roundLabel: round, group: "A", teamA: a, teamB: b,
|
||||
kickoffKst: kickoff, venue, lockAt: lock(kickoff), status: "upcoming",
|
||||
hookText: hook, result: null, updatedAt: FieldValue.serverTimestamp(),
|
||||
kickoffKst: kickoff, venue, opensAt: opens(kickoff), lockAt: kickoff,
|
||||
status: "scheduled", hookText: hook, result: null,
|
||||
updatedAt: FieldValue.serverTimestamp(),
|
||||
});
|
||||
// crowd_stats 초기화 (0)
|
||||
batch.set(db.collection("crowd_stats").doc(matchId), {
|
||||
|
||||
Reference in new issue
Block a user