-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtmp-quest-check.mjs
More file actions
26 lines (23 loc) · 887 Bytes
/
tmp-quest-check.mjs
File metadata and controls
26 lines (23 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import dotenv from "dotenv";
import { db, dbConfig } from "./src/backend/database/dbConfig.js";
import { normalizeQuestSchedule } from "./src/utils/questTiming.js";
dotenv.config();
try {
const snapshot = await db.collection(dbConfig.COLLECTIONS.QUESTS).get();
const quests = snapshot.docs
.map((doc) => ({ id: doc.id, ...doc.data() }))
.filter((quest) => quest.isActive !== false)
.map((quest) => ({
id: quest.id,
name: quest.name || "Untitled Quest",
code: quest.code || "",
description: quest.description || "",
...normalizeQuestSchedule(quest),
}))
.sort((a, b) => String(a.name).localeCompare(String(b.name)));
console.log("Quest fetch logic OK. Count:", quests.length);
console.log(JSON.stringify(quests.slice(0, 2), null, 2));
} catch (error) {
console.error("Quest fetch logic FAILED:", error);
process.exit(1);
}