2026-05-31 15:42:52 +09:00
|
|
|
import http from './http'
|
|
|
|
|
|
|
|
|
|
// 백엔드 /api/account 엔드포인트와 매핑 (본인 데이터만)
|
|
|
|
|
export const accountApi = {
|
|
|
|
|
list({ year, month, type, category, walletId, keyword, tagId } = {}) {
|
|
|
|
|
return http.get('/account/entries', { params: { year, month, type, category, walletId, keyword, tagId } })
|
|
|
|
|
},
|
|
|
|
|
summary({ year, month } = {}) {
|
|
|
|
|
return http.get('/account/summary', { params: { year, month } })
|
|
|
|
|
},
|
|
|
|
|
stats({ unit, year, month } = {}) {
|
|
|
|
|
return http.get('/account/stats', { params: { unit, year, month } })
|
|
|
|
|
},
|
|
|
|
|
categoryStats({ type, year, month } = {}) {
|
|
|
|
|
return http.get('/account/category-stats', { params: { type, year, month } })
|
|
|
|
|
},
|
|
|
|
|
netWorthTrend({ months } = {}) {
|
|
|
|
|
return http.get('/account/networth/trend', { params: { months } })
|
|
|
|
|
},
|
|
|
|
|
create(payload) {
|
|
|
|
|
return http.post('/account/entries', payload)
|
|
|
|
|
},
|
|
|
|
|
update(id, payload) {
|
|
|
|
|
return http.put(`/account/entries/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
remove(id) {
|
|
|
|
|
return http.delete(`/account/entries/${id}`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 계좌/카드 (사용자별)
|
|
|
|
|
wallets() {
|
|
|
|
|
return http.get('/account/wallets')
|
|
|
|
|
},
|
|
|
|
|
netWorth() {
|
|
|
|
|
return http.get('/account/networth')
|
|
|
|
|
},
|
|
|
|
|
repayment(payload) {
|
|
|
|
|
return http.post('/account/repayment', payload)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 정기/반복 거래
|
|
|
|
|
recurrings() {
|
|
|
|
|
return http.get('/account/recurrings')
|
|
|
|
|
},
|
|
|
|
|
createRecurring(payload) {
|
|
|
|
|
return http.post('/account/recurrings', payload)
|
|
|
|
|
},
|
|
|
|
|
updateRecurring(id, payload) {
|
|
|
|
|
return http.put(`/account/recurrings/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeRecurring(id) {
|
|
|
|
|
return http.delete(`/account/recurrings/${id}`)
|
|
|
|
|
},
|
|
|
|
|
runRecurrings() {
|
|
|
|
|
return http.post('/account/recurrings/run')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 예산 (사용자별)
|
|
|
|
|
budgets() {
|
|
|
|
|
return http.get('/account/budgets')
|
|
|
|
|
},
|
|
|
|
|
budgetStatus({ year, month }) {
|
|
|
|
|
return http.get('/account/budgets/status', { params: { year, month } })
|
|
|
|
|
},
|
|
|
|
|
budgetPeriod({ unit, year, month }) {
|
|
|
|
|
return http.get('/account/budgets/period', { params: { unit, year, month } })
|
|
|
|
|
},
|
2026-06-01 22:37:56 +09:00
|
|
|
expectedIncome() {
|
|
|
|
|
return http.get('/account/budgets/income')
|
|
|
|
|
},
|
|
|
|
|
setExpectedIncome(expectedIncome) {
|
|
|
|
|
return http.put('/account/budgets/income', { expectedIncome })
|
|
|
|
|
},
|
2026-05-31 15:42:52 +09:00
|
|
|
createBudget(payload) {
|
|
|
|
|
return http.post('/account/budgets', payload)
|
|
|
|
|
},
|
|
|
|
|
updateBudget(id, payload) {
|
|
|
|
|
return http.put(`/account/budgets/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeBudget(id) {
|
|
|
|
|
return http.delete(`/account/budgets/${id}`)
|
|
|
|
|
},
|
|
|
|
|
createWallet(payload) {
|
|
|
|
|
return http.post('/account/wallets', payload)
|
|
|
|
|
},
|
|
|
|
|
updateWallet(id, payload) {
|
|
|
|
|
return http.put(`/account/wallets/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeWallet(id) {
|
|
|
|
|
return http.delete(`/account/wallets/${id}`)
|
|
|
|
|
},
|
|
|
|
|
walletEntries(id) {
|
|
|
|
|
return http.get(`/account/wallets/${id}/entries`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 투자 포트폴리오 (C) — 종목/매매
|
|
|
|
|
investHoldings(walletId) {
|
|
|
|
|
return http.get('/account/invest/holdings', { params: { walletId } })
|
|
|
|
|
},
|
|
|
|
|
createHolding(payload) {
|
|
|
|
|
return http.post('/account/invest/holdings', payload)
|
|
|
|
|
},
|
|
|
|
|
updateHolding(id, payload) {
|
|
|
|
|
return http.put(`/account/invest/holdings/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeHolding(id) {
|
|
|
|
|
return http.delete(`/account/invest/holdings/${id}`)
|
|
|
|
|
},
|
|
|
|
|
holdingTrades(holdingId) {
|
|
|
|
|
return http.get(`/account/invest/holdings/${holdingId}/trades`)
|
|
|
|
|
},
|
|
|
|
|
addTrade(holdingId, payload) {
|
|
|
|
|
return http.post(`/account/invest/holdings/${holdingId}/trades`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeTrade(id) {
|
|
|
|
|
return http.delete(`/account/invest/trades/${id}`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 분류(카테고리) — 사용자별
|
|
|
|
|
categories() {
|
|
|
|
|
return http.get('/account/categories')
|
|
|
|
|
},
|
|
|
|
|
createCategory(payload) {
|
|
|
|
|
return http.post('/account/categories', payload)
|
|
|
|
|
},
|
|
|
|
|
updateCategory(id, payload) {
|
|
|
|
|
return http.put(`/account/categories/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeCategory(id) {
|
|
|
|
|
return http.delete(`/account/categories/${id}`)
|
|
|
|
|
},
|
2026-06-01 22:37:56 +09:00
|
|
|
reorderCategories(type, ids) {
|
|
|
|
|
return http.put('/account/categories/reorder', { type, ids })
|
|
|
|
|
},
|
2026-05-31 15:42:52 +09:00
|
|
|
importCategories() {
|
|
|
|
|
return http.post('/account/categories/import')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 사용자별 가계부 태그
|
|
|
|
|
tags() {
|
|
|
|
|
return http.get('/account/tags')
|
|
|
|
|
},
|
|
|
|
|
createTag(payload) {
|
|
|
|
|
return http.post('/account/tags', payload)
|
|
|
|
|
},
|
|
|
|
|
updateTag(id, payload) {
|
|
|
|
|
return http.put(`/account/tags/${id}`, payload)
|
|
|
|
|
},
|
|
|
|
|
removeTag(id) {
|
|
|
|
|
return http.delete(`/account/tags/${id}`)
|
|
|
|
|
},
|
|
|
|
|
}
|