refactor: oauth2登录重构

This commit is contained in:
meilin.huang
2023-07-22 20:51:46 +08:00
parent ffacfc3ae8
commit 155ae65b4a
50 changed files with 1069 additions and 1060 deletions

View File

@@ -6,7 +6,6 @@ import (
var (
accountApp = newAccountApp(persistence.GetAccountRepo())
authApp = newAuthApp(persistence.GetOAuthAccountRepo())
configApp = newConfigApp(persistence.GetConfigRepo())
resourceApp = newResourceApp(persistence.GetResourceRepo())
roleApp = newRoleApp(persistence.GetRoleRepo())
@@ -17,10 +16,6 @@ func GetAccountApp() Account {
return accountApp
}
func GetAuthApp() Auth {
return authApp
}
func GetConfigApp() Config {
return configApp
}

View File

@@ -1,29 +0,0 @@
package application
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/internal/sys/domain/repository"
)
type Auth interface {
GetOAuthAccount(condition *entity.OAuthAccount, cols ...string) error
BindOAuthAccount(e *entity.OAuthAccount) error
}
func newAuthApp(oauthAccountRepo repository.OAuthAccount) Auth {
return &authAppImpl{
oauthAccountRepo: oauthAccountRepo,
}
}
type authAppImpl struct {
oauthAccountRepo repository.OAuthAccount
}
func (a *authAppImpl) GetOAuthAccount(condition *entity.OAuthAccount, cols ...string) error {
return a.oauthAccountRepo.GetOAuthAccount(condition, cols...)
}
func (a *authAppImpl) BindOAuthAccount(e *entity.OAuthAccount) error {
return a.oauthAccountRepo.SaveOAuthAccount(e)
}