Fix/transaction inconsitensies (#190)
* fix: request explicit page size from Enable Banking API to fetch all transactions The API defaults to ~10 transactions per page when no limit is specified, causing incomplete syncs for users with more transactions. * fix: enhance DELETE operations and add missing RLS policies for multi-tenant support
This commit is contained in:
@@ -174,9 +174,9 @@ export async function DELETE(
|
||||
|
||||
const companyId = await requireCompanyId(supabase, user.id)
|
||||
|
||||
const { error } = await supabase
|
||||
const { error, count } = await supabase
|
||||
.from('customers')
|
||||
.delete()
|
||||
.delete({ count: 'exact' })
|
||||
.eq('id', id)
|
||||
.eq('company_id', companyId)
|
||||
|
||||
@@ -184,5 +184,9 @@ export async function DELETE(
|
||||
return NextResponse.json({ error: error.message }, { status: 500 })
|
||||
}
|
||||
|
||||
if (count === 0) {
|
||||
return NextResponse.json({ error: 'Customer not found' }, { status: 404 })
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true })
|
||||
}
|
||||
|
||||
@@ -141,9 +141,9 @@ export async function DELETE(
|
||||
)
|
||||
}
|
||||
|
||||
const { error } = await supabase
|
||||
const { error, count: deleteCount } = await supabase
|
||||
.from('suppliers')
|
||||
.delete()
|
||||
.delete({ count: 'exact' })
|
||||
.eq('id', id)
|
||||
.eq('company_id', companyId)
|
||||
|
||||
@@ -151,5 +151,9 @@ export async function DELETE(
|
||||
return NextResponse.json({ error: error.message }, { status: 500 })
|
||||
}
|
||||
|
||||
if (deleteCount === 0) {
|
||||
return NextResponse.json({ error: 'Supplier not found' }, { status: 404 })
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user