website refactor
This commit is contained in:
26
apps/website/lib/mutations/auth/ResetPasswordMutation.ts
Normal file
26
apps/website/lib/mutations/auth/ResetPasswordMutation.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user