Initial commit: Purrse personal finance app
Self-hosted, plugin-extensible personal finance manager built with ASP.NET Core 9.0, Vue 3 + Vuetify 3, and PostgreSQL 17. Backend (8 .NET projects): - Core: 19 domain models, 6 enums, 14 DTOs, 12 service interfaces - Data: EF Core DbContext, 16 entity configurations, category seeder - API: 14 controllers, 15 services, JWT auth, SignalR, middleware - Plugins: Abstractions + OFX/CSV/QIF file parsers - Tests: 28 xUnit tests (fingerprinting, duplicate detection, parsers) Frontend (Vue 3 + Vuetify 3 + TypeScript): - 13 views, Pinia stores, Axios API services with JWT interceptors - Dashboard, accounts, transactions, categories, imports, and more Deployment: - Docker Compose (PostgreSQL 17 + .NET API + nginx frontend) - Auto-migration on startup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import api from './api'
|
||||
import type { Account } from '@/types'
|
||||
|
||||
export const accountsApi = {
|
||||
getAll: () => api.get<Account[]>('/accounts'),
|
||||
getById: (id: string) => api.get<Account>(`/accounts/${id}`),
|
||||
create: (data: any) => api.post<Account>('/accounts', data),
|
||||
update: (id: string, data: any) => api.put<Account>(`/accounts/${id}`, data),
|
||||
delete: (id: string) => api.delete(`/accounts/${id}`),
|
||||
getBalanceHistory: (id: string, startDate: string, endDate: string) =>
|
||||
api.get(`/accounts/${id}/balance-history`, { params: { startDate, endDate } }),
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import axios from 'axios'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import router from '@/router'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/api',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
|
||||
api.interceptors.request.use(config => {
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.token) {
|
||||
config.headers.Authorization = `Bearer ${authStore.token}`
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
api.interceptors.response.use(
|
||||
response => response,
|
||||
async error => {
|
||||
if (error.response?.status === 401) {
|
||||
const authStore = useAuthStore()
|
||||
try {
|
||||
await authStore.refreshToken()
|
||||
error.config.headers.Authorization = `Bearer ${authStore.token}`
|
||||
return api(error.config)
|
||||
} catch {
|
||||
authStore.logout()
|
||||
router.push('/login')
|
||||
}
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default api
|
||||
@@ -0,0 +1,10 @@
|
||||
import api from './api'
|
||||
import type { Category, CategoryTree } from '@/types'
|
||||
|
||||
export const categoriesApi = {
|
||||
getAll: () => api.get<Category[]>('/categories'),
|
||||
getTree: () => api.get<CategoryTree[]>('/categories/tree'),
|
||||
create: (data: any) => api.post<Category>('/categories', data),
|
||||
update: (id: string, data: any) => api.put<Category>(`/categories/${id}`, data),
|
||||
delete: (id: string) => api.delete(`/categories/${id}`),
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import api from './api'
|
||||
import type { Transaction, PagedResult } from '@/types'
|
||||
|
||||
export const transactionsApi = {
|
||||
getByAccount: (accountId: string, page = 1, pageSize = 50) =>
|
||||
api.get<PagedResult<Transaction>>(`/transactions/account/${accountId}`, { params: { page, pageSize } }),
|
||||
getById: (id: string) => api.get<Transaction>(`/transactions/${id}`),
|
||||
create: (data: any) => api.post<Transaction>('/transactions', data),
|
||||
update: (id: string, data: any) => api.put<Transaction>(`/transactions/${id}`, data),
|
||||
delete: (id: string) => api.delete(`/transactions/${id}`),
|
||||
search: (data: any) => api.post<PagedResult<Transaction>>('/transactions/search', data),
|
||||
createTransfer: (data: any) => api.post('/transactions/transfer', data),
|
||||
void: (id: string) => api.post(`/transactions/${id}/void`),
|
||||
}
|
||||
Reference in New Issue
Block a user