From 6087b35ce5559360b2cbc06813eaabd72ffdfa9a Mon Sep 17 00:00:00 2001 From: 12975 <1297598740@qq.com> Date: Thu, 29 Jan 2026 21:43:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8F=8A=E5=85=B6=E7=9B=B8=E5=85=B3=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89=EF=BC=8C=E5=8C=85=E6=8B=AC=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E7=9A=84=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5=E3=80=81?= =?UTF-8?q?=E8=BD=AC=E8=B4=A6=E3=80=81=E6=8E=92=E5=BA=8F=E5=8F=8A=E4=BD=99?= =?UTF-8?q?=E9=A2=9D=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/accountService.ts | 8 ++++++++ src/types/index.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/services/accountService.ts b/src/services/accountService.ts index 9226d3c..7fd87cd 100644 --- a/src/services/accountService.ts +++ b/src/services/accountService.ts @@ -26,6 +26,12 @@ function mapAccountFromApi(data: Record): Account { lastSyncTime: data.last_sync_time as string | undefined, accountCode: data.account_code as string | undefined, accountType: data.account_type as 'asset' | 'liability' | undefined, + tags: (data.tags as { id: number; name: string; color: string; created_at: string }[] | undefined)?.map(t => ({ + id: t.id, + name: t.name, + color: t.color, + createdAt: t.created_at, + })), }; } @@ -66,6 +72,7 @@ export async function createAccount(data: AccountFormInput): Promise { payment_date: data.paymentDate, warning_threshold: data.warningThreshold, account_code: data.accountCode, + tag_ids: data.tagIds, }; const response = await api.post>('/accounts', payload); if (!response.data) { @@ -91,6 +98,7 @@ export async function updateAccount(id: number, data: Partial) if (data.warningThreshold !== undefined) payload.warning_threshold = data.warningThreshold; if (data.accountCode !== undefined) payload.account_code = data.accountCode; if (data.accountType !== undefined) payload.account_type = data.accountType; + if (data.tagIds !== undefined) payload.tag_ids = data.tagIds; const response = await api.put>(`/accounts/${id}`, payload); if (!response.data) { diff --git a/src/types/index.ts b/src/types/index.ts index 272ca48..3a80d4e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -149,6 +149,7 @@ export interface Account { lastSyncTime?: string; accountCode?: string; accountType?: 'asset' | 'liability'; + tags?: Tag[]; } // Budget Interface @@ -294,6 +295,7 @@ export interface AccountFormInput { warningThreshold?: number; accountCode?: string; accountType?: 'asset' | 'liability'; + tagIds?: number[]; } export interface TransferFormInput {