Prettier format pending files
This commit is contained in:
parent
85b7a48abf
commit
ccc280001e
5 changed files with 50 additions and 87 deletions
|
|
@ -15,13 +15,10 @@ export default async (req: Request) => {
|
|||
headers.get("Authorization")?.replace("Bearer ", "") || "";
|
||||
|
||||
if (adminToken !== "mrpiglr-admin-token") {
|
||||
return new Response(
|
||||
JSON.stringify({ error: "Unauthorized" }),
|
||||
{
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
},
|
||||
);
|
||||
return new Response(JSON.stringify({ error: "Unauthorized" }), {
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
const { email } = await req.json();
|
||||
|
|
@ -62,52 +59,28 @@ export default async (req: Request) => {
|
|||
|
||||
// Delete from various tables
|
||||
// 1. Delete achievements
|
||||
await supabase
|
||||
.from("achievements_earned")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("achievements_earned").delete().eq("user_id", userId);
|
||||
|
||||
// 2. Delete applications
|
||||
await supabase
|
||||
.from("applications")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("applications").delete().eq("user_id", userId);
|
||||
|
||||
// 3. Delete creator profiles
|
||||
await supabase
|
||||
.from("creator_profiles")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("creator_profiles").delete().eq("user_id", userId);
|
||||
|
||||
// 4. Delete projects
|
||||
await supabase
|
||||
.from("projects")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("projects").delete().eq("user_id", userId);
|
||||
|
||||
// 5. Delete social posts
|
||||
await supabase
|
||||
.from("social_posts")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("social_posts").delete().eq("user_id", userId);
|
||||
|
||||
// 6. Delete linked emails
|
||||
await supabase
|
||||
.from("user_email_links")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("user_email_links").delete().eq("user_id", userId);
|
||||
|
||||
// 7. Delete Discord links
|
||||
await supabase
|
||||
.from("discord_links")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("discord_links").delete().eq("user_id", userId);
|
||||
|
||||
// 8. Delete web3 wallets
|
||||
await supabase
|
||||
.from("web3_wallets")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await supabase.from("web3_wallets").delete().eq("user_id", userId);
|
||||
|
||||
// 9. Delete user profile
|
||||
const { error: profileDeleteError } = await supabase
|
||||
|
|
@ -130,8 +103,9 @@ export default async (req: Request) => {
|
|||
|
||||
// 10. Delete from Supabase auth (this is a special call)
|
||||
// Note: This requires admin access and will remove the auth user
|
||||
const { error: authError } = await (supabase.auth.admin as any)
|
||||
.deleteUser(userId);
|
||||
const { error: authError } = await (supabase.auth.admin as any).deleteUser(
|
||||
userId,
|
||||
);
|
||||
|
||||
if (authError) {
|
||||
console.error("Auth deletion error:", authError);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ export const ethosStorage = {
|
|||
* @returns The public URL for the file
|
||||
*/
|
||||
getPublicUrl(filePath: string): string {
|
||||
const { data } = supabase.storage
|
||||
.from(BUCKET_NAME)
|
||||
.getPublicUrl(filePath);
|
||||
const { data } = supabase.storage.from(BUCKET_NAME).getPublicUrl(filePath);
|
||||
|
||||
return data.publicUrl;
|
||||
},
|
||||
|
|
@ -116,9 +114,7 @@ export const ethosStorage = {
|
|||
*/
|
||||
async getFileMetadata(filePath: string) {
|
||||
try {
|
||||
const { data, error } = await supabase.storage
|
||||
.from(BUCKET_NAME)
|
||||
.info();
|
||||
const { data, error } = await supabase.storage.from(BUCKET_NAME).info();
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
|
|
@ -139,7 +135,8 @@ export const ethosStorage = {
|
|||
*/
|
||||
export async function getAudioDuration(file: File): Promise<number> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
||||
const audioContext = new (window.AudioContext ||
|
||||
(window as any).webkitAudioContext)();
|
||||
const fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = async (e) => {
|
||||
|
|
|
|||
|
|
@ -318,9 +318,7 @@ export default function Dashboard() {
|
|||
console.log("User and profile exist, loading dashboard data");
|
||||
loadDashboardData();
|
||||
} else if (user && !profile) {
|
||||
console.log(
|
||||
"User exists but no profile, keeping loading screen visible",
|
||||
);
|
||||
console.log("User exists but no profile, keeping loading screen visible");
|
||||
// Keep loading visible while waiting for profile, then onboarding will take over
|
||||
// Don't set isLoading to false yet
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,11 @@
|
|||
href="https://docs.aethex.tech/~gitbook/image?url=https%3A%2F%2F1143808467-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Forganizations%252FDhUg3jal6kdpG645FzIl%252Fsites%252Fsite_HeOmR%252Flogo%252FqxDYz8Oj2SnwUTa8t3UB%252FAeThex%2520Origin%2520logo.png%3Falt%3Dmedia%26token%3D200e8ea2-0129-4cbe-b516-4a53f60c512b&width=180&dpr=1&quality=100&sign=6c7576ce&sv=2"
|
||||
/>
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link rel="alternate" type="application/json" href="/discord-manifest.json" />
|
||||
<link
|
||||
rel="alternate"
|
||||
type="application/json"
|
||||
href="/discord-manifest.json"
|
||||
/>
|
||||
<meta name="msapplication-TileColor" content="#0a0aff" />
|
||||
|
||||
<!-- Open Graph -->
|
||||
|
|
|
|||
|
|
@ -1094,7 +1094,7 @@ export function createServer() {
|
|||
});
|
||||
return res.status(500).json({
|
||||
error: insertError.message,
|
||||
details: insertError.details
|
||||
details: insertError.details,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -2523,19 +2523,17 @@ export function createServer() {
|
|||
};
|
||||
|
||||
const uuidId = generateDeterministicUUID(achievement.id);
|
||||
const { error } = await adminSupabase
|
||||
.from("achievements")
|
||||
.upsert(
|
||||
{
|
||||
id: uuidId,
|
||||
name: achievement.name,
|
||||
description: achievement.description,
|
||||
icon: achievement.icon,
|
||||
badge_color: achievement.badge_color,
|
||||
xp_reward: achievement.xp_reward,
|
||||
},
|
||||
{ onConflict: "id" }
|
||||
);
|
||||
const { error } = await adminSupabase.from("achievements").upsert(
|
||||
{
|
||||
id: uuidId,
|
||||
name: achievement.name,
|
||||
description: achievement.description,
|
||||
icon: achievement.icon,
|
||||
badge_color: achievement.badge_color,
|
||||
xp_reward: achievement.xp_reward,
|
||||
},
|
||||
{ onConflict: "id" },
|
||||
);
|
||||
|
||||
if (error) {
|
||||
console.error(
|
||||
|
|
@ -4120,7 +4118,10 @@ export function createServer() {
|
|||
devconnect_link: devConnectLink,
|
||||
});
|
||||
} catch (e: any) {
|
||||
console.error("[Creator API] Error fetching creator by user_id:", e?.message);
|
||||
console.error(
|
||||
"[Creator API] Error fetching creator by user_id:",
|
||||
e?.message,
|
||||
);
|
||||
return res.status(500).json({ error: "Failed to fetch creator" });
|
||||
}
|
||||
});
|
||||
|
|
@ -5079,9 +5080,7 @@ export function createServer() {
|
|||
res.status(201).json(data[0]);
|
||||
} catch (e: any) {
|
||||
console.error("[Ethos Tracks API] Error creating track:", e?.message);
|
||||
res
|
||||
.status(500)
|
||||
.json({ error: e?.message || "Failed to create track" });
|
||||
res.status(500).json({ error: e?.message || "Failed to create track" });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -5170,7 +5169,10 @@ export function createServer() {
|
|||
offset: Number(offset),
|
||||
});
|
||||
} catch (e: any) {
|
||||
console.error("[Ethos Artists API] Error fetching artists:", e?.message);
|
||||
console.error(
|
||||
"[Ethos Artists API] Error fetching artists:",
|
||||
e?.message,
|
||||
);
|
||||
res
|
||||
.status(500)
|
||||
.json({ error: e?.message || "Failed to fetch artists" });
|
||||
|
|
@ -5810,25 +5812,16 @@ export function createServer() {
|
|||
.delete()
|
||||
.eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("applications")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await adminSupabase.from("applications").delete().eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("creator_profiles")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("projects")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await adminSupabase.from("projects").delete().eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("social_posts")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await adminSupabase.from("social_posts").delete().eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("user_email_links")
|
||||
|
|
@ -5840,10 +5833,7 @@ export function createServer() {
|
|||
.delete()
|
||||
.eq("user_id", userId);
|
||||
|
||||
await adminSupabase
|
||||
.from("web3_wallets")
|
||||
.delete()
|
||||
.eq("user_id", userId);
|
||||
await adminSupabase.from("web3_wallets").delete().eq("user_id", userId);
|
||||
|
||||
// Delete user profile
|
||||
const { error: profileDeleteError } = await adminSupabase
|
||||
|
|
|
|||
Loading…
Reference in a new issue