mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 02:26:43 +02:00
- Move finance, mail, moodlit to apps-archived for later development - Rename games/voxel-lava to games/voxelava 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
1,000 B
TypeScript
25 lines
1,000 B
TypeScript
import { apiClient } from './client';
|
|
import type { Account, CreateAccountInput, UpdateAccountInput } from '@finance/shared';
|
|
|
|
export const accountsApi = {
|
|
getAll: () => apiClient.get<Account[]>('/accounts'),
|
|
|
|
getAllIncludingArchived: () => apiClient.get<Account[]>('/accounts/all'),
|
|
|
|
getOne: (id: string) => apiClient.get<Account>(`/accounts/${id}`),
|
|
|
|
getTotals: () =>
|
|
apiClient.get<{ currency: string; total: number; count: number }[]>('/accounts/totals'),
|
|
|
|
create: (data: CreateAccountInput) => apiClient.post<Account>('/accounts', data),
|
|
|
|
update: (id: string, data: UpdateAccountInput) => apiClient.put<Account>(`/accounts/${id}`, data),
|
|
|
|
delete: (id: string) => apiClient.delete<{ success: boolean }>(`/accounts/${id}`),
|
|
|
|
archive: (id: string) => apiClient.post<Account>(`/accounts/${id}/archive`),
|
|
|
|
unarchive: (id: string) => apiClient.post<Account>(`/accounts/${id}/unarchive`),
|
|
|
|
reorder: (accountIds: string[]) => apiClient.put<Account[]>('/accounts/reorder', { accountIds }),
|
|
};
|