Files
pn-new-crm/src/app/api/v1/currency/rates/route.ts

16 lines
486 B
TypeScript
Raw Normal View History

import { NextResponse } from 'next/server';
import { withAuth } from '@/lib/api/helpers';
import { errorResponse } from '@/lib/errors';
import { db } from '@/lib/db';
import { currencyRates } from '@/lib/db/schema/system';
export const GET = withAuth(async (_req, _ctx) => {
try {
const rates = await db.select().from(currencyRates).orderBy(currencyRates.baseCurrency);
return NextResponse.json({ data: rates });
} catch (error) {
return errorResponse(error);
}
});