feat : update
This commit is contained in:
+18
-2
@@ -66,6 +66,22 @@ function catalogCharacterWithUrls(
|
||||
};
|
||||
}),
|
||||
})),
|
||||
leveling: item.leveling.map((group) => ({
|
||||
...group,
|
||||
items: group.items.map((entry) => {
|
||||
const material = materialByKey.get(entry.key);
|
||||
return {
|
||||
...entry,
|
||||
name: material?.name ?? entry.key,
|
||||
description: material?.description ?? null,
|
||||
rarity: material?.rarity ?? null,
|
||||
type: material?.type ?? null,
|
||||
imageUrl: material ? publicMediaUrl(material.imageKey) : null,
|
||||
lunarisUrl: `https://lunaris.moe/material/${encodeURIComponent(entry.key)}`,
|
||||
available: Boolean(material),
|
||||
};
|
||||
}),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -125,7 +141,7 @@ export async function getGuideByCharacterKey(characterKey: string) {
|
||||
.limit(1);
|
||||
if (!row) return null;
|
||||
const materialKeys = [...new Set(
|
||||
row.character.ascension.flatMap((group) => group.items.map((item) => item.key)),
|
||||
[...row.character.ascension, ...row.character.leveling].flatMap((group) => group.items.map((item) => item.key)),
|
||||
)];
|
||||
const [materials, poster, bleeding] = await Promise.all([
|
||||
materialKeys.length
|
||||
@@ -162,7 +178,7 @@ async function getGuideContent(slug: string, publicOnly: boolean) {
|
||||
.limit(1);
|
||||
if (!row) return null;
|
||||
const materialKeys = [...new Set(
|
||||
row.character.ascension.flatMap((group) => group.items.map((item) => item.key)),
|
||||
[...row.character.ascension, ...row.character.leveling].flatMap((group) => group.items.map((item) => item.key)),
|
||||
)];
|
||||
const [sections, weaponConditionsRows, groups, profile, constellationGroups, teams, aliases, materials, poster, bleeding] = await Promise.all([
|
||||
getDb().select().from(guideSections).where(and(eq(guideSections.guideId, row.guide.id), eq(guideSections.enabled, true))).orderBy(asc(guideSections.sortOrder)),
|
||||
|
||||
@@ -37,9 +37,9 @@ export const updateGuideSchema = z.strictObject({
|
||||
overview: z.string().trim().min(1).max(500),
|
||||
youtubeUrl: youtubeUrlSchema,
|
||||
posterArtMediaId: z.string().uuid().nullable().optional(),
|
||||
posterArtOffsetX: z.number().finite().min(-50).max(50).optional(),
|
||||
posterArtOffsetY: z.number().finite().min(-50).max(50).optional(),
|
||||
posterArtScale: z.number().finite().min(50).max(200).optional(),
|
||||
posterArtOffsetX: z.number().finite().min(-1000).max(1000).optional(),
|
||||
posterArtOffsetY: z.number().finite().min(-1000).max(1000).optional(),
|
||||
posterArtScale: z.number().finite().min(50).max(500).optional(),
|
||||
posterTopColors: z.tuple([z.string().regex(/^#[0-9a-fA-F]{6}$/u), z.string().regex(/^#[0-9a-fA-F]{6}$/u)]).optional(),
|
||||
posterBottomColors: z.tuple([z.string().regex(/^#[0-9a-fA-F]{6}$/u), z.string().regex(/^#[0-9a-fA-F]{6}$/u)]).optional(),
|
||||
posterBleeding: z.array(z.strictObject({
|
||||
|
||||
Reference in New Issue
Block a user