Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app/api/transactions/history/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export async function GET(req: NextRequest) {

const supabase = createServerClient()
const { searchParams } = new URL(req.url)
const limit = Math.min(parseInt(searchParams.get('limit') || '50'), 100)

let limit = parseInt(searchParams.get('limit') || '50')
if (isNaN(limit) || limit < 1) limit = 50
limit = Math.min(limit, 100)

// 1. Fetch Sent Transactions (where customer_wallet = walletAddress)
const { data: sentTransactions, error: sentError } = await supabase
Expand Down
5 changes: 4 additions & 1 deletion src/app/api/transactions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export async function GET(req: NextRequest) {
const supabase = createServerClient()
const { searchParams } = new URL(req.url)
const paymentLinkId = searchParams.get('payment_link_id')
const limit = Math.min(parseInt(searchParams.get('limit') || '50'), 100)

let limit = parseInt(searchParams.get('limit') || '50')
if (isNaN(limit) || limit < 1) limit = 50
limit = Math.min(limit, 100)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let query = (supabase.from('transactions') as any)
Expand Down
9 changes: 7 additions & 2 deletions src/app/api/v1/payment-links/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ export async function GET(req: NextRequest) {
}

const { searchParams } = new URL(req.url)
const limit = Math.min(parseInt(searchParams.get('limit') || '10'), 100)
const offset = parseInt(searchParams.get('offset') || '0')

let limit = parseInt(searchParams.get('limit') || '10')
if (isNaN(limit) || limit < 1) limit = 10
limit = Math.min(limit, 100)

let offset = parseInt(searchParams.get('offset') || '0')
if (isNaN(offset) || offset < 0) offset = 0

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const supabase = createServerClient() as any
Expand Down
10 changes: 8 additions & 2 deletions src/app/api/v1/transactions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ export async function GET(req: NextRequest) {
}

const { searchParams } = new URL(req.url)
const limit = Math.min(parseInt(searchParams.get('limit') || '10'), 100)
const offset = parseInt(searchParams.get('offset') || '0')

let limit = parseInt(searchParams.get('limit') || '10')
if (isNaN(limit) || limit < 1) limit = 10
limit = Math.min(limit, 100)

let offset = parseInt(searchParams.get('offset') || '0')
if (isNaN(offset) || offset < 0) offset = 0

const status = searchParams.get('status')
const paymentLinkId = searchParams.get('payment_link_id')

Expand Down
Loading