website refactor

This commit is contained in:
2026-01-14 02:02:24 +01:00
parent 8d7c709e0c
commit 4522d41aef
291 changed files with 12763 additions and 9309 deletions

View File

@@ -0,0 +1,26 @@
/**
* Forgot Password Mutation
*
* Framework-agnostic mutation for forgot password operations.
* Called from Server Actions.
*
* Pattern: Server Action → Mutation → Service → API Client
*/
import { Result } from '@/lib/contracts/Result';
import { AuthService } from '@/lib/services/auth/AuthService';
import { ForgotPasswordDTO } from '@/lib/types/generated/ForgotPasswordDTO';
import { ForgotPasswordResult } from '@/lib/mutations/auth/types/ForgotPasswordResult';
export class ForgotPasswordMutation {
async execute(params: ForgotPasswordDTO): Promise<Result<ForgotPasswordResult, string>> {
try {
const authService = new AuthService();
const result = await authService.forgotPassword(params);
return Result.ok(result);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Failed to send reset link';
return Result.err(errorMessage);
}
}
}

View File

@@ -0,0 +1,26 @@
/**
* Login Mutation
*
* Framework-agnostic mutation for login operations.
* Called from Server Actions.
*
* Pattern: Server Action → Mutation → Service → API Client
*/
import { Result } from '@/lib/contracts/Result';
import { AuthService } from '@/lib/services/auth/AuthService';
import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
import { LoginParamsDTO } from '@/lib/types/generated/LoginParamsDTO';
export class LoginMutation {
async execute(params: LoginParamsDTO): Promise<Result<SessionViewModel, string>> {
try {
const authService = new AuthService();
const session = await authService.login(params);
return Result.ok(session);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Login failed';
return Result.err(errorMessage);
}
}
}

View File

@@ -0,0 +1,26 @@
/**
* Reset Password Mutation
*
* Framework-agnostic mutation for reset password operations.
* Called from Server Actions.
*
* Pattern: Server Action → Mutation → Service → API Client
*/
import { Result } from '@/lib/contracts/Result';
import { AuthService } from '@/lib/services/auth/AuthService';
import { ResetPasswordDTO } from '@/lib/types/generated/ResetPasswordDTO';
import { ResetPasswordResult } from '@/lib/mutations/auth/types/ResetPasswordResult';
export class ResetPasswordMutation {
async execute(params: ResetPasswordDTO): Promise<Result<ResetPasswordResult, string>> {
try {
const authService = new AuthService();
const result = await authService.resetPassword(params);
return Result.ok(result);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Failed to reset password';
return Result.err(errorMessage);
}
}
}

View File

@@ -0,0 +1,26 @@
/**
* Signup Mutation
*
* Framework-agnostic mutation for signup operations.
* Called from Server Actions.
*
* Pattern: Server Action → Mutation → Service → API Client
*/
import { Result } from '@/lib/contracts/Result';
import { AuthService } from '@/lib/services/auth/AuthService';
import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
import { SignupParamsDTO } from '@/lib/types/generated/SignupParamsDTO';
export class SignupMutation {
async execute(params: SignupParamsDTO): Promise<Result<SessionViewModel, string>> {
try {
const authService = new AuthService();
const session = await authService.signup(params);
return Result.ok(session);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Signup failed';
return Result.err(errorMessage);
}
}
}

View File

@@ -0,0 +1,11 @@
/**
* Forgot Password Mutation Result
*
* Result type for forgot password operations.
* This represents the successful outcome of a forgot password mutation.
*/
export interface ForgotPasswordResult {
message: string;
magicLink?: string;
}

View File

@@ -0,0 +1,10 @@
/**
* Reset Password Mutation Result
*
* Result type for reset password operations.
* This represents the successful outcome of a reset password mutation.
*/
export interface ResetPasswordResult {
message: string;
}