Skip to content

Commit acd7007

Browse files
authored
refactor: remove dead code (#758)
1 parent e6f43c5 commit acd7007

File tree

3 files changed

+0
-102
lines changed

3 files changed

+0
-102
lines changed

internal/pkg/test/web.go

-15
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
"github.com/bangumi/server/internal/user"
4747
"github.com/bangumi/server/web"
4848
"github.com/bangumi/server/web/handler"
49-
"github.com/bangumi/server/web/session"
5049
)
5150

5251
type Mock struct {
@@ -63,7 +62,6 @@ type Mock struct {
6362
RevisionRepo revision.Repo
6463
CollectionRepo collections.Repo
6564
TimeLineSrv timeline.Service
66-
SessionManager session.Manager
6765
Cache cache.RedisCache
6866
HTTPMock *httpmock.MockTransport
6967
Dam *dam.Dam
@@ -102,7 +100,6 @@ func GetWebApp(tb testing.TB, m Mock) *echo.Echo {
102100
MockUserRepo(m.UserRepo),
103101
MockIndexRepo(m.IndexRepo),
104102
MockRevisionRepo(m.RevisionRepo),
105-
MockSessionManager(m.SessionManager),
106103
MockTimeLineSrv(m.TimeLineSrv),
107104
MockTagRepo(m.TagRepo),
108105

@@ -155,18 +152,6 @@ func MockIndexRepo(repo index.Repo) fx.Option {
155152
return fx.Supply(fx.Annotate(repo, fx.As(new(index.Repo))))
156153
}
157154

158-
func MockSessionManager(repo session.Manager) fx.Option {
159-
if repo == nil {
160-
mocker := &mocks.SessionManager{}
161-
mocker.EXPECT().Create(mock.Anything, mock.Anything).Return("mocked random string", session.Session{}, nil)
162-
mocker.EXPECT().Get(mock.Anything, mock.Anything).Return(session.Session{}, nil)
163-
164-
repo = mocker
165-
}
166-
167-
return fx.Provide(func() session.Manager { return repo })
168-
}
169-
170155
func MockUserRepo(repo user.Repo) fx.Option {
171156
if repo == nil {
172157
return fx.Provide(AnyUserMock)

web/handler/common/common.go

-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ import (
2121

2222
"github.com/bangumi/server/config"
2323
"github.com/bangumi/server/internal/auth"
24-
"github.com/bangumi/server/web/session"
2524
)
2625

2726
func New(
2827
log *zap.Logger,
2928
auth auth.Service,
30-
session session.Manager,
3129
config config.AppConfig,
3230
) (Common, error) {
3331
validate, trans, err := getValidator()
@@ -38,7 +36,6 @@ func New(
3836
log = log.Named("handler.Common")
3937
return Common{
4038
Config: config,
41-
session: session,
4239
auth: auth,
4340
log: log,
4441
skip1Log: log.WithOptions(zap.AddCallerSkip(1)),
@@ -52,7 +49,6 @@ type Common struct {
5249
auth auth.Service
5350
skip1Log *zap.Logger
5451
log *zap.Logger
55-
session session.Manager
5652
V *validator.Validate
5753
validatorTranslation ut.Translator
5854
}

web/handler/common/session.go

-83
This file was deleted.

0 commit comments

Comments
 (0)