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)