refactor(guides) : consolidate duplicate guide and Stygian logic
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export const stygianLevels = [105, 110] as const;
|
||||
export const stygianBossPositions = [0, 1, 2] as const;
|
||||
export const stygianBossPositionLabels = ["บน", "กลาง", "ล่าง"] as const;
|
||||
+14
-19
@@ -80,25 +80,23 @@ export async function syncStygianArchive() {
|
||||
}
|
||||
|
||||
await db.transaction(async (tx) => {
|
||||
await tx.insert(stygianSchedules).values({
|
||||
scheduleId,
|
||||
const scheduleValues = {
|
||||
challengeName: parsed.data.challengeName,
|
||||
scheduleStartTime: lunarisDate(parsed.data.scheduleStartTime),
|
||||
scheduleEndTime: lunarisDate(parsed.data.scheduleEndTime),
|
||||
};
|
||||
await tx.insert(stygianSchedules).values({
|
||||
scheduleId,
|
||||
...scheduleValues,
|
||||
}).onConflictDoUpdate({
|
||||
target: stygianSchedules.scheduleId,
|
||||
set: {
|
||||
challengeName: parsed.data.challengeName,
|
||||
scheduleStartTime: lunarisDate(parsed.data.scheduleStartTime),
|
||||
scheduleEndTime: lunarisDate(parsed.data.scheduleEndTime),
|
||||
...scheduleValues,
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
for (const boss of bosses) {
|
||||
await tx.insert(stygianBosses).values({
|
||||
scheduleId,
|
||||
level: boss.level,
|
||||
position: boss.position,
|
||||
const bossValues = {
|
||||
configId: boss.configId,
|
||||
name: boss.name,
|
||||
hp: String(boss.hp),
|
||||
@@ -107,18 +105,15 @@ export async function syncStygianArchive() {
|
||||
recommendedMechanics: boss.recommendedMechanics,
|
||||
recommendedMechanicTypes: boss.recommendedMechanicTypes,
|
||||
imageKey: imageKeyByName.get(boss.imageName)!,
|
||||
};
|
||||
await tx.insert(stygianBosses).values({
|
||||
scheduleId,
|
||||
level: boss.level,
|
||||
position: boss.position,
|
||||
...bossValues,
|
||||
}).onConflictDoUpdate({
|
||||
target: [stygianBosses.scheduleId, stygianBosses.level, stygianBosses.position],
|
||||
set: {
|
||||
configId: boss.configId,
|
||||
name: boss.name,
|
||||
hp: String(boss.hp),
|
||||
description: boss.description,
|
||||
mechanics: boss.mechanics,
|
||||
recommendedMechanics: boss.recommendedMechanics,
|
||||
recommendedMechanicTypes: boss.recommendedMechanicTypes,
|
||||
imageKey: imageKeyByName.get(boss.imageName)!,
|
||||
},
|
||||
set: bossValues,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import * as z from "zod";
|
||||
|
||||
export const stygianLevels = [105, 110] as const;
|
||||
import { stygianLevels } from "@/lib/stygian/constants";
|
||||
|
||||
export { stygianLevels } from "@/lib/stygian/constants";
|
||||
|
||||
export const stygianElements = ["Anemo", "Geo", "Electro", "Dendro", "Hydro", "Pyro", "Cryo"] as const;
|
||||
|
||||
const levelConfigSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user