refactor: change all user to account

This commit is contained in:
Leon
2025-12-05 14:25:39 +08:00
parent 311a27523f
commit c5331a459f
8 changed files with 95 additions and 95 deletions

View File

@@ -11,26 +11,26 @@ import (
func SetRouter(db *gorm.DB) *gin.Engine {
r := gin.Default()
userRepository := account.NewUserRepository(db)
userService := account.NewUserService(userRepository)
userHandler := NewUserHandler(userService)
userGroup := r.Group("/user")
accountRepository := account.NewAccountRepository(db)
accountService := account.NewAccountService(accountRepository)
accountHandler := NewAccountHandler(accountService)
accountGroup := r.Group("/account")
{
userGroup.POST("/register", userHandler.CreateUser)
userGroup.POST("/rename", userHandler.RenameByID)
userGroup.POST("/changePassword", userHandler.ChangePassword)
userGroup.POST("/findByID", userHandler.FindByID)
userGroup.POST("/findByUsername", userHandler.FindByUsername)
accountGroup.POST("/register", accountHandler.CreateAccount)
accountGroup.POST("/rename", accountHandler.RenameByID)
accountGroup.POST("/changePassword", accountHandler.ChangePassword)
accountGroup.POST("/findByID", accountHandler.FindByID)
accountGroup.POST("/findByUsername", accountHandler.FindByUsername)
}
authGroup := r.Group("/auth")
{
authGroup.POST("/login", userHandler.Login)
authGroup.POST("/login", accountHandler.Login)
}
protectedAuthGroup := authGroup.Group("")
protectedAuthGroup.Use(middleware.JWTAuth())
{
protectedAuthGroup.POST("/logout", userHandler.Logout)
protectedAuthGroup.POST("/logout", accountHandler.Logout)
}
return r