Skip to content

feat: PUT /sponsorship_activities/{id}/status の実装#1065

Merged
Wakai111 merged 1 commit intodevelopfrom
feat/kubosaka/update-sponsorship-activity-status
Mar 18, 2026
Merged

feat: PUT /sponsorship_activities/{id}/status の実装#1065
Wakai111 merged 1 commit intodevelopfrom
feat/kubosaka/update-sponsorship-activity-status

Conversation

@Kubosaka
Copy link
Copy Markdown
Collaborator

対応Issue

resolve #0

概要

協賛活動のステータスのみを更新する API (PUT /sponsorship_activities/{id}/status) を実装。

  • OpenAPI: UpdateSponsorshipActivityStatusRequest スキーマを追加し、requestBody を $ref に変更
  • Repository: UpdateStatus() に goqu による UPDATE SQL を実装
  • UseCase: UpdateSponsorshipActivityStatus() のシグネチャを generated 型に統一し、更新後に全データを返すよう実装
  • Handler: mock レスポンスを本実装に置き換え

更新対象フィールド: activityStatus / feasibilityStatus / designProgress / remarks

テスト項目

  • PUT /sponsorship_activities/{id}/status で各ステータスフィールドが更新されること
  • レスポンスに SponsorshipActivity 全体が返ること
  • remarks を省略した場合も正常に動作すること

備考

なし

- OpenAPI に UpdateSponsorshipActivityStatusRequest スキーマを追加
- Repository: UpdateStatus に goqu による SQL 実装を追加
- UseCase: UpdateSponsorshipActivityStatus のシグネチャを generated 型に統一し、更新後に全体を返すよう実装
- Handler: mock を本実装に置き換え

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying finansu with  Cloudflare Pages  Cloudflare Pages

Latest commit: f061304
Status: ✅  Deploy successful!
Preview URL: https://9fc5befc.finansu.pages.dev
Branch Preview URL: https://feat-kubosaka-update-sponsor-rh9a.finansu.pages.dev

View logs

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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エンドポイント PUT /sponsorship_activities/{id}/status を実装しました。
  • OpenAPIスキーマの更新: OpenAPIスキーマに UpdateSponsorshipActivityStatusRequest を追加し、リクエストボディの参照を更新しました。
  • リポジトリ層のロジック実装: リポジトリ層の UpdateStatus() メソッドで goqu を使用し、データベースのステータス更新SQLクエリを実装しました。
  • ユースケース層の改善: ユースケース層の UpdateSponsorshipActivityStatus メソッドのシグネチャを generated 型に統一し、更新後に活動データ全体を返すように変更しました。
  • ハンドラー層のモック置換: ハンドラー層で PUT /sponsorship_activities/{id}/status のモックレスポンスを実際のロジックに置き換えました。
  • 更新対象フィールド: 更新対象となるステータスフィールドは activityStatusfeasibilityStatusdesignProgressremarks です。
Changelog
  • api/externals/handler/sponsorship_activity_handler.go
    • PutSponsorshipActivitiesIdStatus エンドポイントのモックレスポンスを実際のステータス更新ロジックに置き換えました。
  • api/externals/repository/sponsorship_activity_repository.go
    • UpdateStatus メソッドを実装し、goqu を用いてデータベースの sponsorship_activities テーブルのステータス関連フィールドを更新するようにしました。
  • api/generated/openapi_gen.go
    • UpdateSponsorshipActivityStatusRequest 型を新規追加し、PutSponsorshipActivitiesIdStatusJSONRequestBody がこの新しい型を参照するように変更しました。
  • api/internals/usecase/sponsorship_activity_usecase.go
    • UpdateSponsorshipActivityStatus メソッドの引数と戻り値の型を generated 型に統一し、更新後に最新の協賛活動データを取得して返すように修正しました。
  • openapi/openapi.yaml
    • PUT /sponsorship_activities/{id}/status エンドポイントのリクエストボディスキーマを UpdateSponsorshipActivityStatusRequest として定義し、そのコンポーネントスキーマを追加しました。
  • view/next-project/src/components/budget_managements/BudgetManagement.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/budget_managements/DeleteBudgetManagementModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/common/Header/Header.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/common/RegistModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/common/SideNav.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/layout/LoginLayout.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/layout/MainLayout/MainLayout.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/purchasereports/EditModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/purchasereports/PurchaseReportConfirmModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/purchasereports/ReceiptModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/purchasereports/UploadFileModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/sponsoractivities/AddBlankInvoiceModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/sponsoractivities/AddBlankReceiptModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/sponsoractivities/FilterModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/sponsoractivities/SponsorActivitiesAddModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/components/sponsoractivities/UploadFileModal.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/generated/hooks.ts
    • putSponsorshipActivitiesIdStatus 関数の型定義と引数が更新されました。
  • view/next-project/src/generated/model/index.ts
    • updateSponsorshipActivityStatusRequest がエクスポートに追加されました。
  • view/next-project/src/generated/model/updateSponsorshipActivityStatusRequest.ts
    • UpdateSponsorshipActivityStatusRequest インターフェースが新規追加されました。
  • view/next-project/src/pages/404.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/500.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/create_purchase_report/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/reset_password/[id]/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/sponsoractivities/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/sponsorstyles/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/users/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
  • view/next-project/src/pages/yearperiods/index.tsx
    • HTML要素の className 属性のフォーマットを調整しました。
Activity
  • このプルリクエストには、これまでのレビューコメントや進捗に関する特筆すべき活動はありません。
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
Copy Markdown
Contributor

@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

このプルリクエストは、協賛活動のステータスを更新するための PUT /sponsorship_activities/{id}/status エンドポイントを実装するものです。OpenAPI定義の更新、ハンドラ、ユースケース、リポジトリ層の実装が含まれています。全体的に、プルリクエストの目的に沿った良い実装です。エラーハンドリングと堅牢性をさらに向上させるための提案をいくつかコメントしました。また、多くのフロントエンドファイルにフォーマットの変更が加えられていますが、これらは問題ないようです。

Comment on lines +373 to +374
_, err = r.client.DB().ExecContext(ctx, query, args...)
return err
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

UPDATEクエリ実行後、実際にレコードが更新されたかを確認することをお勧めします。ExecContextは対象のレコードが存在しない場合でもエラーを返しません。result.RowsAffected()をチェックし、更新された行が0の場合はsql.ErrNoRowsのようなエラーを返すことで、呼び出し元が存在しないIDに対する更新を検知できるようになります。これにより、APIはより堅牢になり、クライアントに404 Not Foundのような適切なステータスコードを返すことが可能になります。

	result, err := r.client.DB().ExecContext(ctx, query, args...)
	if err != nil {
		return err
	}
	rowsAffected, err := result.RowsAffected()
	if err != nil {
		return err
	}
	if rowsAffected == 0 {
		return sql.ErrNoRows
	}
	return nil

Comment on lines +88 to +95
if err := c.Bind(&req); err != nil {
return c.String(http.StatusBadRequest, "Bad Request")
}

updated, err := h.sponsorshipActivityUseCase.UpdateSponsorshipActivityStatus(c.Request().Context(), id, req)
if err != nil {
return c.String(http.StatusInternalServerError, "failed to update status")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

エラーハンドリングを改善し、他のハンドラとの一貫性を保つことをお勧めします。c.String()で固定の文字列を返す代わりに、echoのデフォルトエラーハンドラに処理を委譲するために、単にreturn errとするのが一般的です。これにより、API全体で一貫したエラーレスポンス形式を維持しやすくなります。

Suggested change
if err := c.Bind(&req); err != nil {
return c.String(http.StatusBadRequest, "Bad Request")
}
updated, err := h.sponsorshipActivityUseCase.UpdateSponsorshipActivityStatus(c.Request().Context(), id, req)
if err != nil {
return c.String(http.StatusInternalServerError, "failed to update status")
}
if err := c.Bind(&req); err != nil {
return err
}
updated, err := h.sponsorshipActivityUseCase.UpdateSponsorshipActivityStatus(c.Request().Context(), id, req)
if err != nil {
return err
}

Base automatically changed from feat/kubosaka/update-sponsorship-activity to develop March 18, 2026 04:32
@Wakai111 Wakai111 merged commit b844428 into develop Mar 18, 2026
5 checks passed
@Wakai111 Wakai111 deleted the feat/kubosaka/update-sponsorship-activity-status branch March 18, 2026 04:32
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.

2 participants