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:
parent
81233b788b
commit
312072a869
12 changed files with 15 additions and 14 deletions
|
|
@ -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) {
|
||||
return res.status(400).json({ error: "No access token in response" });
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ interface FoundationTokenResponse {
|
|||
id: string;
|
||||
email: string;
|
||||
username: string;
|
||||
full_name?: string;
|
||||
profile_complete: boolean;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,9 +209,9 @@ export default async function handler(req: any, res: any) {
|
|||
return res.status(404).json({ error: "Agreement not found" });
|
||||
}
|
||||
|
||||
const licensee = agreement.user_profiles?.[0];
|
||||
const artist = agreement.ethos_tracks?.user_profiles?.[0];
|
||||
const trackTitle = agreement.ethos_tracks?.title;
|
||||
const licensee = (agreement as any).user_profiles?.[0];
|
||||
const artist = (agreement as any).ethos_tracks?.user_profiles?.[0];
|
||||
const trackTitle = (agreement as any).ethos_tracks?.title;
|
||||
|
||||
if (!licensee?.email) {
|
||||
return res.status(400).json({ error: "Licensee email not found" });
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export default async function handler(req: any, res: any) {
|
|||
.eq("id", id)
|
||||
.single();
|
||||
|
||||
if (build?.gameforge_projects?.lead_id !== userId) {
|
||||
if ((build?.gameforge_projects as any)?.lead_id !== userId) {
|
||||
return res
|
||||
.status(403)
|
||||
.json({ error: "Only project lead can update builds" });
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
|
|||
success: true,
|
||||
game_token: gameToken,
|
||||
user_id: userData.id,
|
||||
username: userData.username || roblox_username,
|
||||
username: (userData as any).username || roblox_username,
|
||||
expires_in: 86400, // seconds
|
||||
});
|
||||
} catch (error: any) {
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ export default async function handler(req: any, res: any) {
|
|||
});
|
||||
|
||||
if (emailResponse.ok) {
|
||||
const emails = await emailResponse.json();
|
||||
const primaryEmail = emails.find((e: any) => e.primary);
|
||||
const emails = (await emailResponse.json()) as Array<{ email: string; primary: boolean }>;
|
||||
const primaryEmail = emails.find((e) => e.primary);
|
||||
email = primaryEmail?.email || emails[0]?.email;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ async function handleSyncProducts(req: any, res: any) {
|
|||
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 || [];
|
||||
|
||||
// Sync products to Supabase
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Stripe from "stripe";
|
|||
import { getAdminClient } from "../../_supabase.js";
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Stripe from "stripe";
|
|||
import { getAdminClient } from "../../_supabase.js";
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Stripe from "stripe";
|
|||
import { getAdminClient } from "../../_supabase.js";
|
||||
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Stripe from "stripe";
|
|||
import { getAdminClient } from "../../_supabase.js";
|
||||
|
||||
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
|
||||
apiVersion: "2024-11-20",
|
||||
apiVersion: "2024-04-10",
|
||||
});
|
||||
|
||||
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET || "";
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export default async (req: Request) => {
|
|||
|
||||
// DELETE - Remove arm affiliation
|
||||
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;
|
||||
|
||||
if (!VALID_ARMS.includes(arm)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue