Fix Session.id type and restore nested passkey routes

- Change Session.id from number to string to match DB bigint type
- Restore me.passkeys.{list,rename,delete} nested route structure
- Remove unnecessary String() conversion in logout procedure
- Auto-formatted procedure files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
RevIQ
2026-01-09 15:44:45 +08:00
parent 1858ea9783
commit 617fa78046
7 changed files with 285 additions and 213 deletions

View File

@@ -18,32 +18,32 @@ import { authMiddleware, os } from "../base.js";
export const resendVerificationEmail = os.auth.resendVerificationEmail
.use(authMiddleware)
.handler(async ({ context }) => {
// Check if email is already verified
if (context.user.emailVerifiedAt !== null) {
// Email already verified, return early
return;
}
// Check if email is already verified
if (context.user.emailVerifiedAt !== null) {
// Email already verified, return early
return;
}
// Delete any existing verification tokens for this user
await context.db
.deleteFrom("email_verifications")
.where("user_id", "=", context.user.id)
.execute();
// Delete any existing verification tokens for this user
await context.db
.deleteFrom("email_verifications")
.where("user_id", "=", context.user.id)
.execute();
// Generate new secure token
const token = generateSecureToken();
const expiresAt = generateExpiry(TOKEN_DURATIONS.EMAIL_VERIFICATION);
// Generate new secure token
const token = generateSecureToken();
const expiresAt = generateExpiry(TOKEN_DURATIONS.EMAIL_VERIFICATION);
// Create new verification record
await context.db
.insertInto("email_verifications")
.values({
user_id: context.user.id,
token,
expires_at: expiresAt,
})
.execute();
// Create new verification record
await context.db
.insertInto("email_verifications")
.values({
user_id: context.user.id,
token,
expires_at: expiresAt,
})
.execute();
// Send verification email (stubbed)
await sendVerificationEmail(context.user.email, token);
});
// Send verification email (stubbed)
await sendVerificationEmail(context.user.email, token);
});