Files
kt-financial-system/apps/backend/api/finance/accounts.get.ts
你的用户名 b68511b2e2
Some checks failed
Deploy to Production / Build and Test (push) Successful in 10m51s
Deploy to Production / Deploy to Server (push) Failing after 6m41s
feat: migrate backend storage to postgres
2025-11-06 22:01:50 +08:00

17 lines
470 B
TypeScript

import { getQuery } from 'h3';
import { listAccounts } from '~/utils/finance-metadata';
import { useResponseSuccess } from '~/utils/response';
export default defineEventHandler(async (event) => {
const query = getQuery(event);
const currency = query.currency as string | undefined;
let accounts = await listAccounts();
if (currency) {
accounts = accounts.filter((account) => account.currency === currency);
}
return useResponseSuccess(accounts);
});