Fix various type errors in API files to ensure proper functionality

Resolves TypeScript errors across multiple API files, including Stripe API version mismatches and incorrect type assertions for request data, enabling successful Vercel builds.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: c124cc2e-6c8d-4ca4-80d3-5d34ca7aed66
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/qPXTzuE
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-08 01:29:26 +00:00
parent 81233b788b
commit 312072a869
12 changed files with 15 additions and 14 deletions

View file

@ -47,7 +47,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
}); });
} }
const tokenData = await tokenResponse.json(); const tokenData = (await tokenResponse.json()) as { access_token?: string; user?: { id: string } };
if (!tokenData.access_token) { if (!tokenData.access_token) {
return res.status(400).json({ error: "No access token in response" }); return res.status(400).json({ error: "No access token in response" });

View file

@ -20,6 +20,7 @@ interface FoundationTokenResponse {
id: string; id: string;
email: string; email: string;
username: string; username: string;
full_name?: string;
profile_complete: boolean; profile_complete: boolean;
}; };
} }

View file

@ -209,9 +209,9 @@ export default async function handler(req: any, res: any) {
return res.status(404).json({ error: "Agreement not found" }); return res.status(404).json({ error: "Agreement not found" });
} }
const licensee = agreement.user_profiles?.[0]; const licensee = (agreement as any).user_profiles?.[0];
const artist = agreement.ethos_tracks?.user_profiles?.[0]; const artist = (agreement as any).ethos_tracks?.user_profiles?.[0];
const trackTitle = agreement.ethos_tracks?.title; const trackTitle = (agreement as any).ethos_tracks?.title;
if (!licensee?.email) { if (!licensee?.email) {
return res.status(400).json({ error: "Licensee email not found" }); return res.status(400).json({ error: "Licensee email not found" });

View file

@ -132,7 +132,7 @@ export default async function handler(req: any, res: any) {
.eq("id", id) .eq("id", id)
.single(); .single();
if (build?.gameforge_projects?.lead_id !== userId) { if ((build?.gameforge_projects as any)?.lead_id !== userId) {
return res return res
.status(403) .status(403)
.json({ error: "Only project lead can update builds" }); .json({ error: "Only project lead can update builds" });

View file

@ -102,7 +102,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
success: true, success: true,
game_token: gameToken, game_token: gameToken,
user_id: userData.id, user_id: userData.id,
username: userData.username || roblox_username, username: (userData as any).username || roblox_username,
expires_in: 86400, // seconds expires_in: 86400, // seconds
}); });
} catch (error: any) { } catch (error: any) {

View file

@ -179,8 +179,8 @@ export default async function handler(req: any, res: any) {
}); });
if (emailResponse.ok) { if (emailResponse.ok) {
const emails = await emailResponse.json(); const emails = (await emailResponse.json()) as Array<{ email: string; primary: boolean }>;
const primaryEmail = emails.find((e: any) => e.primary); const primaryEmail = emails.find((e) => e.primary);
email = primaryEmail?.email || emails[0]?.email; email = primaryEmail?.email || emails[0]?.email;
} }
} }

View file

@ -136,7 +136,7 @@ async function handleSyncProducts(req: any, res: any) {
throw new Error(`Failed to fetch products: ${response.statusText}`); throw new Error(`Failed to fetch products: ${response.statusText}`);
} }
const data = await response.json(); const data = (await response.json()) as { products?: FourthwallProduct[] };
const products: FourthwallProduct[] = data.products || []; const products: FourthwallProduct[] = data.products || [];
// Sync products to Supabase // Sync products to Supabase

View file

@ -3,7 +3,7 @@ import Stripe from "stripe";
import { getAdminClient } from "../../_supabase.js"; import { getAdminClient } from "../../_supabase.js";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-11-20", apiVersion: "2024-04-10",
}); });
export default async function handler(req: VercelRequest, res: VercelResponse) { export default async function handler(req: VercelRequest, res: VercelResponse) {

View file

@ -3,7 +3,7 @@ import Stripe from "stripe";
import { getAdminClient } from "../../_supabase.js"; import { getAdminClient } from "../../_supabase.js";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-11-20", apiVersion: "2024-04-10",
}); });
export default async function handler(req: VercelRequest, res: VercelResponse) { export default async function handler(req: VercelRequest, res: VercelResponse) {

View file

@ -3,7 +3,7 @@ import Stripe from "stripe";
import { getAdminClient } from "../../_supabase.js"; import { getAdminClient } from "../../_supabase.js";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-11-20", apiVersion: "2024-04-10",
}); });
const apiBase = process.env.VITE_API_BASE || "https://aethex.dev"; const apiBase = process.env.VITE_API_BASE || "https://aethex.dev";

View file

@ -3,7 +3,7 @@ import Stripe from "stripe";
import { getAdminClient } from "../../_supabase.js"; import { getAdminClient } from "../../_supabase.js";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-11-20", apiVersion: "2024-04-10",
}); });
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET || ""; const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET || "";

View file

@ -87,7 +87,7 @@ export default async (req: Request) => {
// DELETE - Remove arm affiliation // DELETE - Remove arm affiliation
if (req.method === "DELETE") { if (req.method === "DELETE") {
const body = await req.json(); const body = (await req.json()) as { arm: string; affiliation_type?: string };
const { arm, affiliation_type } = body; const { arm, affiliation_type } = body;
if (!VALID_ARMS.includes(arm)) { if (!VALID_ARMS.includes(arm)) {