Visitar URL original
Refactor game services and API endpoints with security improvements by cwchanap · Pull Request #18 · cwchanap/cetus · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: improve API response consistency and streak update accuracy
  • Loading branch information
cwchanap committed Feb 16, 2026
commit 1da704d5710df328d629e5ee7fd6d0a01c7c7586
2 changes: 1 addition & 1 deletion src/lib/server/db/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ export async function updateAllUserStreaksForUTC(): Promise<{
}

return {
processed: allUserIds.length,
processed: activeUserIds.length + inactiveUserIds.length,
incremented: activeUserIds.length,
reset: inactiveUserIds.length,
}
Expand Down
8 changes: 7 additions & 1 deletion src/pages/api/login-rewards/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export const POST: APIRoute = async ({ locals }) => {
const result = await claimDailyLoginReward(user.id)

if (!result.success) {
return badRequestResponse(result.error || 'Failed to claim reward')
return jsonResponse(
{
success: false,
error: result.error || 'Failed to claim reward',
},
400
)
}

return jsonResponse(result)
Expand Down
4 changes: 0 additions & 4 deletions src/pages/api/user/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export const POST: APIRoute = async ({ request, locals }) => {
updates.username = username
Comment thread
cwchanap marked this conversation as resolved.
Resolved
}

if (Object.keys(updates).length === 0) {
return badRequestResponse('No valid fields to update')
}

const success = await updateUser(user.id, updates as UserUpdate)
if (!success) {
return errorResponse('Failed to update profile')
Expand Down