'use server'; import { Result } from '@/lib/contracts/Result'; import { GenerateAvatarsMutation } from '@/lib/mutations/onboarding/GenerateAvatarsMutation'; /** * Generate avatars - thin wrapper around mutation * * Note: This action requires userId to be passed from the client. * The client should get userId from session and pass it as a parameter. */ export async function generateAvatarsAction(params: { userId: string; facePhotoData: string; suitColor: string; }): Promise> { const mutation = new GenerateAvatarsMutation(); const result = await mutation.execute(params); if (result.isErr()) { return Result.err(result.getError()); } const data = result.unwrap(); return Result.ok({ success: data.success, avatarUrls: data.avatarUrls }); }