refactor: Implement dependency injection for handlers and services

- Refactored AuthHandler, UserHandler, TextureHandler, ProfileHandler, CaptchaHandler, and YggdrasilHandler to use dependency injection.
- Removed direct instantiation of services and repositories within handlers, replacing them with constructor injection.
- Updated the container to initialize service instances and provide them to handlers.
- Enhanced code structure for better testability and adherence to Go best practices.
This commit is contained in:
lafay
2025-12-02 19:43:39 +08:00
parent 188a05caa7
commit 801f1b1397
33 changed files with 3628 additions and 4129 deletions

2
go.mod
View File

@@ -9,7 +9,6 @@ require (
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/joho/godotenv v1.5.1
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
github.com/lib/pq v1.10.9
github.com/minio/minio-go/v7 v7.0.66
github.com/redis/go-redis/v9 v9.0.5
github.com/spf13/viper v1.21.0
@@ -28,6 +27,7 @@ require (
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/stretchr/testify v1.11.1 // indirect
golang.org/x/image v0.16.0 // indirect
golang.org/x/sync v0.16.0 // indirect
gorm.io/driver/mysql v1.5.6 // indirect