feat: add daily win recording endpoint, user authentication, and profile management

- Implemented a POST endpoint for recording daily wins in the game.
- Created login and signup functionality with email and password.
- Developed a profile page allowing users to update their profile information, change passwords, and manage active sessions.
- Added a toggle feature for switching between login and signup forms.
- Enhanced the layout by removing the profile button and adjusting the header structure.
This commit is contained in:
2026-03-01 23:01:44 +01:00
parent e45dfb9832
commit 114f6cde7a
28 changed files with 2603 additions and 31 deletions

View File

@@ -0,0 +1,38 @@
import { error } from '@sveltejs/kit';
import { db } from '$lib/server/db';
import { config } from '$lib/server/db/schema';
import { getDailyModeCharacters, getOrCreateTodayCharacter, getYesterdayCharacter } from '$lib/server/daily-character';
import { like } from 'drizzle-orm';
export async function load() {
const characters = await getDailyModeCharacters();
const dailyCharacter = await getOrCreateTodayCharacter(characters);
if (!dailyCharacter) {
throw error(404, 'No daily character available. Please check if characters are configured in daily mode.');
}
const yesterdayCharacter = await getYesterdayCharacter(new Date(), characters);
// 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,
dailyCharacter,
yesterdayCharacter,
columnVisibility
};
}