fix build

This commit is contained in:
wass08
2026-03-04 16:29:55 +01:00
parent 47747495e5
commit 299cbdb0b3
7 changed files with 17 additions and 37 deletions
+6 -3
View File
@@ -22,11 +22,12 @@ export async function PUT(
return NextResponse.json({ error: 'Nothing to update' }, { status: 400 })
}
const { data: existing } = await supabaseAdmin
const existingResult = await supabaseAdmin
.from('presets')
.select('user_id')
.eq('id', id)
.single()
const existing = existingResult.data as { user_id: string | null } | null
if (!existing || existing.user_id !== session.user.id) {
return NextResponse.json({ error: 'Not found or forbidden' }, { status: 403 })
@@ -37,7 +38,8 @@ export async function PUT(
if (data !== undefined) updates.data = data
if (is_community !== undefined) updates.is_community = is_community
const { data: preset, error } = await supabaseAdmin
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data: preset, error } = await (supabaseAdmin as any)
.from('presets')
.update(updates)
.eq('id', id)
@@ -60,11 +62,12 @@ export async function DELETE(
const { id } = await params
const { data: existing } = await supabaseAdmin
const existingResult = await supabaseAdmin
.from('presets')
.select('user_id, thumbnail_url')
.eq('id', id)
.single()
const existing = existingResult.data as { user_id: string | null; thumbnail_url: string | null } | null
if (!existing || existing.user_id !== session.user.id) {
return NextResponse.json({ error: 'Not found or forbidden' }, { status: 403 })
@@ -16,11 +16,12 @@ export async function POST(
const { id } = await params
const { data: existing } = await supabaseAdmin
const existingResult = await supabaseAdmin
.from('presets')
.select('user_id')
.eq('id', id)
.single()
const existing = existingResult.data as { user_id: string | null } | null
if (!existing || existing.user_id !== session.user.id) {
return NextResponse.json({ error: 'Not found or forbidden' }, { status: 403 })
@@ -46,7 +47,8 @@ export async function POST(
const thumbnailUrl = `${urlData.publicUrl}?t=${Date.now()}`
const { error: updateError } = await supabaseAdmin
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { error: updateError } = await (supabaseAdmin as any)
.from('presets')
.update({ thumbnail_url: thumbnailUrl })
.eq('id', id)
+2 -1
View File
@@ -61,7 +61,8 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ error: 'Invalid type' }, { status: 400 })
}
const { data: preset, error } = await supabaseAdmin
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data: preset, error } = await (supabaseAdmin as any)
.from('presets')
.insert({
id: createId('preset'),
@@ -1,6 +1,5 @@
'use server'
import type { createClient } from '@supabase/supabase-js'
import { createServerSupabaseClient } from '../database/server'
import { getSession } from '../auth/server'
import { createId } from '../utils/id-generator'
@@ -83,7 +82,7 @@ export async function uploadProjectAsset(
const url = urlData.publicUrl
// Record in project_assets table
const { error: insertError } = await (supabase.from('project_assets') as any).insert({
const { error: insertError } = await (supabase as any).from('project_assets').insert({
id: assetId,
project_id: projectId,
storage_key: storageKey,
@@ -144,9 +143,7 @@ export async function createAssetUploadUrl(
const assetId = createId('asset')
const storageKey = ext ? `${projectId}/${assetId}.${ext}` : `${projectId}/${assetId}`
const { data, error } = await (
supabase as ReturnType<typeof createClient>
).storage
const { data, error } = await supabase.storage
.from(BUCKET)
.createSignedUploadUrl(storageKey)
@@ -203,7 +200,7 @@ export async function confirmAssetUpload(
const url = urlData.publicUrl
const { error: insertError } = await (supabase.from('project_assets') as any).insert({
const { error: insertError } = await (supabase as any).from('project_assets').insert({
id: assetId,
project_id: projectId,
storage_key: storageKey,
@@ -273,7 +270,7 @@ export async function deleteProjectAssetByUrl(
}
// Delete DB row by storage_key scoped to this project
const { error: dbError } = await (supabase.from('project_assets') as any)
const { error: dbError } = await (supabase as any).from('project_assets')
.delete()
.eq('project_id', projectId)
.eq('storage_key', storageKeyFromUrl)
+1
View File
@@ -150,6 +150,7 @@ export interface Database {
created_at?: string
updated_at?: string
}
Relationships: []
}
}
Views: {}
@@ -1,17 +0,0 @@
CREATE TABLE "presets" (
"id" text PRIMARY KEY NOT NULL,
"type" text NOT NULL,
"name" text NOT NULL,
"data" jsonb NOT NULL,
"thumbnail_url" text,
"user_id" text,
"is_community" boolean DEFAULT false NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "presets" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
ALTER TABLE "presets" ADD CONSTRAINT "presets_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "presets_type_idx" ON "presets" USING btree ("type");--> statement-breakpoint
CREATE INDEX "presets_user_id_idx" ON "presets" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "presets_is_community_idx" ON "presets" USING btree ("is_community");
-7
View File
@@ -71,13 +71,6 @@
"when": 1772573729680,
"tag": "20260303213529_marvelous_mikhail_rasputin",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1772626520793,
"tag": "20260304121520_daffy_gideon",
"breakpoints": true
}
]
}