CSV取込機能を実装し、Expenseモデルと関連するStore・ExpenseCategoryモデルを追加。CSVパーサーを作成し、出光CSVに対応。明細編集画面のAJAX保存機能を実装し、取込結果を表示する機能を追加。作業ログをdiary.mdに追記。

This commit is contained in:
president
2025-12-19 15:51:14 +09:00
parent 5fc2a31f50
commit 89caf3438a
11 changed files with 489 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
from __future__ import annotations
from dataclasses import dataclass
from datetime import date
from typing import Iterable
@dataclass(frozen=True)
class ExpenseRow:
use_date: date
description: str
amount: int
note: str
source: str
source_hash: str
class CSVParserBase:
source: str = ''
def detect(self, header_line: str) -> bool:
raise NotImplementedError
def parse(self, lines: Iterable[str]) -> list[ExpenseRow]:
raise NotImplementedError