[PR #2670] [MERGED] refactor(handler): extract framework-agnostic lifecycle into Do* functions #10110

Closed
opened 2026-04-23 09:24:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2670
Author: @tink-bot
Created: 4/21/2026
Status: Merged
Merged: 4/21/2026
Merged by: @kolaente

Base: mainHead: refactor-do-lifecycle


📝 Commits (6)

  • 967ab05 refactor(handler): extract DoCreate from CreateWeb
  • 5bbbfd6 refactor(handler): extract DoReadOne from ReadOneWeb
  • 702049d refactor(handler): extract DoReadAll from ReadAllWeb
  • dc808e7 refactor(handler): extract DoUpdate from UpdateWeb
  • bd06894 refactor(handler): extract DoDelete from DeleteWeb
  • 1b5a9eb refactor(handler): return domain error for forbidden instead of echo.HTTPError

📊 Changes

7 files changed (+273 additions, -173 deletions)

View changed files

pkg/web/handler/core.go (+211 -0)
📝 pkg/web/handler/create.go (+1 -38)
📝 pkg/web/handler/delete.go (+1 -36)
pkg/web/handler/error.go (+55 -0)
📝 pkg/web/handler/read_all.go (+1 -22)
📝 pkg/web/handler/read_one.go (+3 -40)
📝 pkg/web/handler/update.go (+1 -37)

📄 Description

Extracts the framework-agnostic lifecycle (DoCreate, DoReadOne, DoReadAll, DoUpdate, DoDelete) out of pkg/web/handler/{create,read_one,read_all,update,delete}.go into a new pkg/web/handler/core.go. Each *Web handler now delegates to its Do* counterpart.

Pure refactor: no behaviour change, no new API surface, no new dependencies. Every existing webtest still passes unchanged.

Cherry-picked from the spike branch spike-huma-openapi3 (see #2659). Shipping this piece independently decouples it from the upcoming Huma + /api/v2 migration so that work doesn't have to carry the refactor with it.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2670 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 4/21/2026 **Status:** ✅ Merged **Merged:** 4/21/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `refactor-do-lifecycle` --- ### 📝 Commits (6) - [`967ab05`](https://github.com/go-vikunja/vikunja/commit/967ab0572ef149a6b1901f9d7e9bd25f966e0db5) refactor(handler): extract DoCreate from CreateWeb - [`5bbbfd6`](https://github.com/go-vikunja/vikunja/commit/5bbbfd6a686925e100ae70eade2276ab912374eb) refactor(handler): extract DoReadOne from ReadOneWeb - [`702049d`](https://github.com/go-vikunja/vikunja/commit/702049dc3ceb670fd1c3ac76f936b00aa381b8d0) refactor(handler): extract DoReadAll from ReadAllWeb - [`dc808e7`](https://github.com/go-vikunja/vikunja/commit/dc808e76a37b5b129ebc7483d57d726bdde39271) refactor(handler): extract DoUpdate from UpdateWeb - [`bd06894`](https://github.com/go-vikunja/vikunja/commit/bd068947993472126d76c78105e5dd0bc953519d) refactor(handler): extract DoDelete from DeleteWeb - [`1b5a9eb`](https://github.com/go-vikunja/vikunja/commit/1b5a9eb318214f6bfc361a7975c41ee1ffef4a2e) refactor(handler): return domain error for forbidden instead of echo.HTTPError ### 📊 Changes **7 files changed** (+273 additions, -173 deletions) <details> <summary>View changed files</summary> ➕ `pkg/web/handler/core.go` (+211 -0) 📝 `pkg/web/handler/create.go` (+1 -38) 📝 `pkg/web/handler/delete.go` (+1 -36) ➕ `pkg/web/handler/error.go` (+55 -0) 📝 `pkg/web/handler/read_all.go` (+1 -22) 📝 `pkg/web/handler/read_one.go` (+3 -40) 📝 `pkg/web/handler/update.go` (+1 -37) </details> ### 📄 Description Extracts the framework-agnostic lifecycle (`DoCreate`, `DoReadOne`, `DoReadAll`, `DoUpdate`, `DoDelete`) out of `pkg/web/handler/{create,read_one,read_all,update,delete}.go` into a new `pkg/web/handler/core.go`. Each `*Web` handler now delegates to its `Do*` counterpart. Pure refactor: no behaviour change, no new API surface, no new dependencies. Every existing webtest still passes unchanged. Cherry-picked from the spike branch `spike-huma-openapi3` (see #2659). Shipping this piece independently decouples it from the upcoming Huma + `/api/v2` migration so that work doesn't have to carry the refactor with it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:24:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#10110