feat : update
This commit is contained in:
+9
-1
@@ -1,5 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { sql } from "drizzle-orm";
|
||||
import * as z from "zod";
|
||||
|
||||
import { getDb } from "@/db/client";
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
} from "@/db/schema";
|
||||
import {
|
||||
ascensionSnapshot,
|
||||
levelingSnapshot,
|
||||
avatarIconName,
|
||||
baseStatsSnapshot,
|
||||
characterDetailSchema,
|
||||
@@ -21,6 +23,7 @@ import {
|
||||
} from "@/lib/catalog/lunaris";
|
||||
import type {
|
||||
CatalogAscensionGroup,
|
||||
CatalogLevelingGroup,
|
||||
CatalogBaseStat,
|
||||
CatalogConstellation,
|
||||
CatalogMaterial,
|
||||
@@ -98,6 +101,7 @@ interface SyncedCharacter {
|
||||
constellations: CatalogConstellation[];
|
||||
talents: CatalogTalent[];
|
||||
ascension: CatalogAscensionGroup[];
|
||||
leveling: CatalogLevelingGroup[];
|
||||
baseStats: CatalogBaseStat[];
|
||||
}
|
||||
|
||||
@@ -288,6 +292,7 @@ async function syncCatalogVersion(version: string, control?: SyncControl): Promi
|
||||
)
|
||||
: [],
|
||||
ascension: detail ? ascensionSnapshot(detail) : [],
|
||||
leveling: detail ? levelingSnapshot(detail) : [],
|
||||
baseStats: detail ? baseStatsSnapshot(detail) : [],
|
||||
};
|
||||
},
|
||||
@@ -324,6 +329,7 @@ async function syncCatalogVersion(version: string, control?: SyncControl): Promi
|
||||
(icon) => `catalog/characters/talents/${webpName(icon)}`,
|
||||
),
|
||||
ascension: ascensionSnapshot(detail),
|
||||
leveling: levelingSnapshot(detail),
|
||||
baseStats: baseStatsSnapshot(detail),
|
||||
};
|
||||
},
|
||||
@@ -475,6 +481,7 @@ async function syncCatalogVersion(version: string, control?: SyncControl): Promi
|
||||
constellations: item.constellations,
|
||||
talents: item.talents,
|
||||
ascension: item.ascension,
|
||||
leveling: item.leveling,
|
||||
baseStats: item.baseStats,
|
||||
})),
|
||||
),
|
||||
@@ -535,6 +542,7 @@ async function syncCatalogVersion(version: string, control?: SyncControl): Promi
|
||||
constellations: item.constellations,
|
||||
talents: item.talents,
|
||||
ascension: item.ascension,
|
||||
leveling: item.leveling,
|
||||
baseStats: item.baseStats,
|
||||
})),
|
||||
);
|
||||
@@ -643,7 +651,7 @@ export async function getCurrentCatalogVersion(): Promise<string | null> {
|
||||
|
||||
async function hasCatalogRecords(): Promise<boolean> {
|
||||
const db = getDb();
|
||||
const [character] = await db.select({ key: catalogCharacters.key }).from(catalogCharacters).limit(1);
|
||||
const [character] = await db.select({ key: catalogCharacters.key }).from(catalogCharacters).where(sql`${catalogCharacters.baseStats} <> '[]'::jsonb`).limit(1);
|
||||
const [material] = await db.select({ key: catalogMaterials.key }).from(catalogMaterials).limit(1);
|
||||
const [weapon] = await db.select({ key: catalogWeapons.key }).from(catalogWeapons).limit(1);
|
||||
const [artifact] = await db.select({ key: catalogArtifacts.key }).from(catalogArtifacts).limit(1);
|
||||
|
||||
Reference in New Issue
Block a user