Replace void returns with { success: true } across all API endpoints
- Add successResponseSchema to common.ts for explicit success responses
- Update all auth, me, orgs, and admin procedures to return { success: true }
- Update contract.ts to use successResponseSchema instead of z.void()
- Add ast-grep rule to prevent future z.void() usage in contracts
- Add build:packages script to root package.json
- Fix test file lint errors with eslint-disable comments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,5 +57,6 @@ export const forgotPassword = os.auth.forgotPassword.handler(
|
||||
|
||||
// Always return success (anti-enumeration)
|
||||
// Don't reveal whether the email exists or not
|
||||
return { success: true };
|
||||
},
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ export const loginPasswordConfirm = os.auth.loginPasswordConfirm.handler(
|
||||
|
||||
// If already completed, return success (idempotent)
|
||||
if (loginRequest.completed_at !== null) {
|
||||
return;
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
// Mark as completed
|
||||
@@ -50,5 +50,7 @@ export const loginPasswordConfirm = os.auth.loginPasswordConfirm.handler(
|
||||
.set({ completed_at: new Date() })
|
||||
.where("id", "=", loginRequest.id)
|
||||
.execute();
|
||||
|
||||
return { success: true };
|
||||
},
|
||||
);
|
||||
|
||||
@@ -111,6 +111,6 @@ export const loginPassword = os.auth.loginPassword.handler(
|
||||
await sendLoginConfirmationEmail(result.email, result.token);
|
||||
}
|
||||
|
||||
// Return void (success)
|
||||
return { success: true };
|
||||
},
|
||||
);
|
||||
|
||||
@@ -23,4 +23,6 @@ export const logout = os.auth.logout
|
||||
|
||||
// Clear the session cookie
|
||||
deleteCookie(context.resHeaders, COOKIE_NAMES.SESSION_TOKEN);
|
||||
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ export const resendVerificationEmail = os.auth.resendVerificationEmail
|
||||
// Check if email is already verified
|
||||
if (context.user.emailVerifiedAt !== null) {
|
||||
// Email already verified, return early
|
||||
return;
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
// Delete any existing verification tokens for this user
|
||||
@@ -49,4 +49,6 @@ export const resendVerificationEmail = os.auth.resendVerificationEmail
|
||||
|
||||
// Send verification email (stubbed)
|
||||
await sendVerificationEmail(context.user.email, token);
|
||||
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
@@ -84,6 +84,6 @@ export const resetPassword = os.auth.resetPassword.handler(
|
||||
.where("revoked_at", "is", null)
|
||||
.execute();
|
||||
|
||||
// Return void on success
|
||||
return { success: true };
|
||||
},
|
||||
);
|
||||
|
||||
@@ -280,4 +280,6 @@ export const signup = os.auth.signup.handler(async ({ input, context }) => {
|
||||
|
||||
// Send verification email (stubbed)
|
||||
await sendVerificationEmail(email, verificationToken);
|
||||
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
@@ -54,5 +54,7 @@ export const verifyEmail = os.auth.verifyEmail.handler(
|
||||
.deleteFrom("email_verifications")
|
||||
.where("id", "=", verification.id)
|
||||
.execute();
|
||||
|
||||
return { success: true };
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user