Skip to content

refactor(services): split client.go user methods into client_user.go#126

Merged
appleboy merged 1 commit intomainfrom
worktree-plan
Mar 22, 2026
Merged

refactor(services): split client.go user methods into client_user.go#126
appleboy merged 1 commit intomainfrom
worktree-plan

Conversation

@appleboy
Copy link
Copy Markdown
Member

Summary

  • Split user self-service methods from internal/services/client.go into client_user.go
  • Pure method relocation — no logic changes
  • client.go reduced from 755 → 594 lines; client_user.go is 174 lines
  • Aligns with existing test split (client_test.go + client_user_test.go)

Moved to client_user.go

Item Type
UserUpdateClientRequest struct
validateUserScopes() helper function
ListClientsByUser() method
UserUpdateClient() method
UserDeleteClient() method

Test plan

  • make build — full build passes
  • make test — all tests pass
  • make lint — 0 issues

🤖 Generated with Claude Code

- Extract UserUpdateClientRequest struct into client_user.go
- Extract validateUserScopes, ListClientsByUser into client_user.go
- Extract UserUpdateClient, UserDeleteClient into client_user.go
- Keep admin methods, shared types, and helpers in client.go

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 22, 2026 02:42
Copy link
Copy Markdown
Contributor

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 refactors the ClientService implementation by extracting non-admin user self-service client operations into a dedicated client_user.go file, matching the existing test split and keeping client.go focused on the broader/admin-capable surface.

Changes:

  • Moved UserUpdateClientRequest into internal/services/client_user.go.
  • Moved user self-service methods (ListClientsByUser, UserUpdateClient, UserDeleteClient) and helper (validateUserScopes) into client_user.go.
  • Removed the relocated definitions from internal/services/client.go (no functional changes).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/services/client_user.go New file containing user self-service client management types/helpers/methods.
internal/services/client.go Removes the user self-service code that was relocated to client_user.go.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@appleboy appleboy merged commit 833ce75 into main Mar 22, 2026
20 checks passed
@appleboy appleboy deleted the worktree-plan branch March 22, 2026 02:52
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 47.12644% with 46 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/services/client_user.go 47.12% 36 Missing and 10 partials ⚠️

📢 Thoughts on this report? Let us know!

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