Skip to content

Conversation

martinyonatann
Copy link
Member

πŸ—οΈ Architecture Enhancement & API Documentation

πŸ“‹ What's Changed

πŸ”„ Mapper Hierarchy Refactoring

  • Moved mappers to top-level architecture following Clean Architecture principles
  • Bottom layers no longer depend on top-layer types
  • Improved separation of concerns and reduced coupling

πŸ“š Swagger Documentation

  • Added complete OpenAPI 2.0 specification
  • Interactive API explorer available at /swagger/
  • Auto-generated docs with request/response schemas

🎯 Design Patterns

Option Pattern

// Flexible User Detail
func(r *repository) UserDetail(ctx context.Context, opts ...entities.UserDetailOption) (user entities.User, err error)

Factory Method Pattern

type UserDetailRequest interface {
    ToUserDetailOption() entities.UserDetailOption
}

// Polymorphic request handling
func GetUserDetail(req UserDetailRequest) {
    option := req.ToUserDetailOption()
    return userService.GetDetail(option)
}

βœ… Benefits

  • Cleaner Dependencies: Better architecture hierarchy
  • Better Documentation: Interactive API docs
  • Flexible APIs: Option pattern for backward compatibility
  • Extensible Code: Easy to add new request types

Copy link

sonarqubecloud bot commented Sep 5, 2025

@martinyonatann martinyonatann merged commit 5c4436b into main Sep 5, 2025
2 checks passed
@martinyonatann martinyonatann deleted the v2 branch September 5, 2025 18:03
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