Skip to content

Conversation

@TkymHrt
Copy link
Member

@TkymHrt TkymHrt commented Dec 14, 2025

対応Issue

https://www.notion.so/nutfes-nutmeg/FinanSu-2b941f19206380518f1af6de573da465
https://nut-m-e-g.slack.com/archives/C020WQ3GY07/p1765010563203229

概要

  • 購入報告一覧APIに financial_record_name / paid_by クエリを追加し、AND 条件で絞り込み可能に
  • 新規 GET /buy_reports/summary を追加し、未精算・未封詰めの合計額を返却
  • OpenAPI を更新し Go コードを再生成、Router/Controller/UseCase/Repository を拡張して新パラメータ・サマリ取得に対応

主要変更ファイル

openapi/openapi.yaml, api/generated/openapi_gen.go, api/router/router.go, api/externals/controller/buy_report_controller.go, api/internals/usecase/buy_report_usecase.go, api/externals/repository/buy_report_repository.go

画面スクリーンショット等

image image

テスト項目

  • Swagger上で動作を検証

@gemini-code-assist
Copy link

Summary of Changes

Hello @TkymHrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、購入報告一覧ページにおけるユーザーエクスペリエンスを向上させることを目的としています。具体的には、購入報告の検索機能に局名と立替者による絞り込みオプションを追加し、さらに未精算・未封詰めの合計金額を迅速に確認できる新しいサマリーAPIを導入しました。これにより、財務管理の効率化とデータアクセスの柔軟性が向上します。

Highlights

  • 購入報告一覧APIの機能拡張: 既存の購入報告一覧API(GET /buy_reports/details)に、financial_record_name(局名)とpaid_by(立替者)による絞り込み機能が追加されました。これにより、より詳細な条件で報告を検索できるようになります。
  • 未精算・未封詰め合計表示APIの追加: 新たにGET /buy_reports/summaryエンドポイントが追加されました。このAPIは、指定された条件(年度、局名、立替者)に基づいて、未精算および未封詰めの購入報告の合計金額を返却します。
  • バックエンドとフロントエンドの連携: OpenAPI仕様が更新され、それに基づいてGo言語のバックエンドコード(Router, Controller, UseCase, Repository)とTypeScriptのフロントエンドフックが自動生成・拡張されました。これにより、新しいAPI機能がシステム全体で利用可能になります。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

このプルリクエストは、購入報告一覧ページに立替者による絞り込み機能と合計金額の表示機能を追加するもので、全体的にうまく実装されています。
APIの拡張、データベースクエリの追加、そして関連する各レイヤー(コントローラ、ユースケース、リポジトリ)の修正が、設計に沿って適切に行われています。
特に、applyBuyReportFiltersヘルパー関数を導入してフィルタリングロジックを共通化した点は、コードの再利用性と保守性を高める良い改善です。

いくつかの改善点についてコメントしました。

  • GetBuyReportsSummaryコントローラにおけるyearパラメータのバリデーション強化
  • エラーハンドリングにおけるロギングの追加

これらの点を修正することで、APIの堅牢性とデバッグの容易さがさらに向上するでしょう。
素晴らしい作業です!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds filtering capabilities and summary functionality to the buy reports (購入報告) feature. It introduces query parameters for filtering by financial record name and payer (立替者), and adds a new summary endpoint that calculates unsettled and unpacked totals.

  • Updates the OpenAPI specification to define new query parameters and the summary endpoint
  • Regenerates frontend TypeScript and backend Go code from the updated OpenAPI spec
  • Implements filtering logic in the repository layer using a shared filter helper function
  • Adds a new summary endpoint that aggregates unsettled/unpacked amounts with SQL CASE expressions

Reviewed changes

Copilot reviewed 5 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openapi/openapi.yaml Adds financial_record_name and paid_by query parameters to /buy_reports/details, defines new /buy_reports/summary endpoint and buyReportSummary schema
api/generated/openapi_gen.go Generated code with new parameter types and endpoint handlers for filtering and summary
api/router/router.go Registers the new /buy_reports/summary route
api/externals/controller/buy_report_controller.go Implements GetBuyReportsSummary handler and updates existing handlers to accept filter parameters
api/internals/usecase/buy_report_usecase.go Adds summary use case method and updates GetBuyReports signature to accept filter parameters
api/externals/repository/buy_report_repository.go Replaces AllByPeriod with AllByFilters, adds SummaryByFilters and shared applyBuyReportFilters helper
view/next-project/src/generated/model/*.ts Generated TypeScript types for new parameters and summary response
view/next-project/src/generated/hooks.ts Generated React hooks for the new summary endpoint

@TkymHrt TkymHrt requested a review from Kubosaka December 17, 2025 11:45
Copy link
Collaborator

@Kubosaka Kubosaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントしました
実装自体は良さそう!
考えすぎかもだけど、運用考えたらデータ周り変更加えた方がいいかなって思いました!

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 28, 2025

Deploying finansu with  Cloudflare Pages  Cloudflare Pages

Latest commit: 693c165
Status: ✅  Deploy successful!
Preview URL: https://310b0a19.finansu.pages.dev
Branch Preview URL: https://feat-yama-purchase-report-so.finansu.pages.dev

View logs

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 15 changed files in this pull request and generated 4 comments.

…_by_user_id to enhance filtering in buy reports
@TkymHrt TkymHrt requested a review from Kubosaka December 28, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants