-
Notifications
You must be signed in to change notification settings - Fork 2
[予算管理]CSVのダウンロードAPI作成 #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // 2つのdsをUNION | ||
| sql := ds.Union(dsExceptItem).Order(goqu.I("id").Asc()) | ||
| query, _, err := sql.ToSQL() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
局や部門だけ登録されている場合にも、予算0として、csvに書き出したいため、UNIONでselectの結果を結合
また、idでソートする(局ごとまとめたいため)
hikahana
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっとコメント!
| csvData := make([][]string, 0) | ||
| HEADER := []string{"局", "部門", "物品", "予算申請金額", "購入金額"} | ||
| csvData = append(csvData, HEADER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| csvData := make([][]string, 0) | |
| HEADER := []string{"局", "部門", "物品", "予算申請金額", "購入金額"} | |
| csvData = append(csvData, HEADER) | |
| header := []string{"局", "部門", "物品", "予算申請金額", "購入金額"} | |
| csvData := [][]string{header} |
こんな感じでも定義できそうかも
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| UpdatedAt time.Time `json:"updatedAt"` | ||
| } | ||
|
|
||
| type FinancialRecordDetail struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FinancialRecordData
で良いのでは?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
途中から名前書いたため残ってましたね、修正しました
type名修正
| LeftJoin(goqu.I("buy_reports"), goqu.On(goqu.I("festival_items.id").Eq(goqu.I("buy_reports.festival_item_id")))). | ||
| GroupBy("financial_records.id") | ||
|
|
||
| // 予算・部門がないものを取得するds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このコメント要らないかも?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
個人的にはコメントで説明があったほうが後々助かるかと思いますので必要かなって思います!
hikahana
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Deploying finansu with
|
| Latest commit: |
b0a5a41
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5957f9d5.finansu.pages.dev |
| Branch Preview URL: | https://feat-kubosaka-budget-csv-dow.finansu.pages.dev |
対応Issue
resolve #0
概要
/financial_records/csv/download?year={year}にブラウザでアクセスしたらcsvがダウンロードされます要件など
画面スクリーンショット等
予算_2025.csv
テスト項目
備考