29 lines
751 B
TypeScript
29 lines
751 B
TypeScript
import { db } from '$lib/server/db';
|
|
import { config } from '$lib/server/db/schema';
|
|
import { getAllCharacters } from '$lib/server/daily-character';
|
|
import { like } from 'drizzle-orm';
|
|
|
|
export async function load() {
|
|
const characters = await getAllCharacters();
|
|
|
|
// Load column visibility config
|
|
const columnConfig = await db
|
|
.select()
|
|
.from(config)
|
|
.where(like(config.key, 'characterHistory.column.%.visible'));
|
|
|
|
// Convert to object for easier access
|
|
const columnVisibility: Record<string, boolean> = {};
|
|
columnConfig.forEach(row => {
|
|
const match = row.key.match(/characterHistory\.column\.(.+)\.visible/);
|
|
if (match) {
|
|
columnVisibility[match[1]] = row.value === 'true';
|
|
}
|
|
});
|
|
|
|
return {
|
|
characters,
|
|
columnVisibility
|
|
};
|
|
}
|