Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions apps/web/app/api/rewards/use/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextResponse } from "next/server";
import { getCurrentUser } from "@/lib/session";
import { usePowerup, type PowerupKind } from "@/lib/rewards";
import { spendPowerup, type PowerupKind } from "@/lib/rewards";

export const runtime = "nodejs";
export const maxDuration = 60;
Expand All @@ -16,7 +16,7 @@ export async function POST(req: Request) {
if (!mediaId || !KINDS.includes(kind)) {
return NextResponse.json({ ok: false, error: "Invalid request." }, { status: 400 });
}
const result = await usePowerup(user.id, mediaId, kind);
const result = await spendPowerup(user.id, mediaId, kind);
if (!result.ok) return NextResponse.json(result, { status: 400 });
return NextResponse.json(result);
}
16 changes: 16 additions & 0 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({ baseDirectory: __dirname });

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
ignores: [".next/**", "out/**", "build/**", "next-env.d.ts"],
},
];

export default eslintConfig;
2 changes: 1 addition & 1 deletion apps/web/lib/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function canUsePowerupOnMedia(userId: string, mediaId: string): Promise<{
}

/** Spend a power-up on a media item (or return the already-unlocked result). */
export async function usePowerup(userId: string, mediaId: string, kind: PowerupKind): Promise<UseResult> {
export async function spendPowerup(userId: string, mediaId: string, kind: PowerupKind): Promise<UseResult> {
const allowed = await canUsePowerupOnMedia(userId, mediaId);
if (!allowed.ok) return allowed;

Expand Down
5 changes: 4 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start -p ${PORT:-3000}",
"lint": "next lint",
"lint": "eslint .",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
Expand All @@ -26,10 +26,13 @@
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.5",
"@types/node": "^22.10.7",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@types/web-push": "^3.6.4",
"eslint": "^9.39.4",
"eslint-config-next": "^15.5.20",
"typescript": "^5.7.3",
"vitest": "^3.2.4"
}
Expand Down
Loading
Loading