Skip to content

refactor(backend): split calls.go and middleware.go by concern#24

Merged
revtex merged 1 commit intodevfrom
refactor/backend-file-splits
Apr 25, 2026
Merged

refactor(backend): split calls.go and middleware.go by concern#24
revtex merged 1 commit intodevfrom
refactor/backend-file-splits

Conversation

@revtex
Copy link
Copy Markdown
Owner

@revtex revtex commented Apr 25, 2026

Summary

Two mechanical file-level splits. No public API changes; no behaviour changes. Same packages, same exported types and functions.

Files

Before After
internal/handler/calls/calls.go — 1518 LOC calls.go (104) Handler/New/limiter • upload.go (833) PostCallUpload + helpers • audio.go (113) GetCallAudio • search.go (440) GetCalls • transcript.go (80) GetCallTranscript
internal/middleware/middleware.go — 392 LOC middleware.go (2) package doc • cors.go (69) CORS • auth.go (192) JWTAuth + OptionalJWTAuth + RequireAdmin + APIKeyAuth + SwaggerCookieAuth • logging.go (73) RequestID + Logger • limits.go (83) RateLimit + MaxBodySize + RateLimitByIP

Verification

  • cd backend && go vet ./... — clean
  • cd backend && go build ./... — clean
  • cd backend && go test ./... — all pass (handler/calls, middleware, full suite)

No public API changes; no behaviour changes.

internal/handler/calls/calls.go (1518 LOC) split into:
- calls.go (104) — Handler struct, New(), getLimiter, apiKeyLimiter, consts
- upload.go (833) — PostCallUpload + helpers
- audio.go (113) — GetCallAudio
- search.go (440) — GetCalls
- transcript.go (80) — GetCallTranscript

internal/middleware/middleware.go (392 LOC) split into:
- middleware.go (2) — package doc only
- cors.go (69) — CORS
- auth.go (192) — JWTAuth, OptionalJWTAuth, RequireAdmin, APIKeyAuth, SwaggerCookieAuth
- logging.go (73) — RequestID, Logger, requestLogLevel
- limits.go (83) — RateLimit, MaxBodySize, RateLimitByIP

Same package, same exports, no behaviour change. go vet, go build, go test ./... all pass.
@revtex revtex merged commit 27a658b into dev Apr 25, 2026
7 checks passed
@revtex revtex deleted the refactor/backend-file-splits branch April 25, 2026 17:46
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.

1 participant