-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 service層を消す #607
🔥 service層を消す #607
Conversation
まだ |
ユニットテストが落ちてるのはserviceのモックを使ってるところをrepositoryのモックに変更する必要があるからですね |
でいけるかな |
@ras0q この方針で良さそうだったら他のserviceも消していきます |
よさそう、お願いします! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
==========================================
- Coverage 66.67% 61.06% -5.61%
==========================================
Files 64 54 -10
Lines 4780 4269 -511
==========================================
- Hits 3187 2607 -580
- Misses 1545 1611 +66
- Partials 48 51 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9c2b7ea
to
acf357f
Compare
39d0fa7
to
b1bed40
Compare
b1bed40
to
8537422
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
いくつか
"github.com/gofrs/uuid" | ||
"github.com/labstack/echo/v4" | ||
"github.com/traPtitech/traPortfolio/usecases/repository" | ||
) | ||
|
||
type UserHandler struct { | ||
s service.UserService | ||
user repository.UserRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移行した時のやつだと思うけどrepositoryを単数使うところと複数使うところで命名が違うのをどうにかしたい
冗長にuserRepoとかでもいい気もする
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traPortfolio/interfaces/handler/contest.go
Lines 17 to 19 in 6442b2c
type ContestHandler struct { | |
r repository.ContestRepository | |
} |
traPortfolio/interfaces/handler/user.go
Lines 15 to 18 in 4e547ae
type UserHandler struct { | |
user repository.UserRepository | |
event repository.EventRepository | |
} |
ここ?1文字の方をcontest
とかにrenameしたら良さそうに見えるけど
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
まさにそこです
まあcontestRepo(sitory)
が冗長そうならcontest
でいい気もする
関連?: #573
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
それかMockRepositoryで実装してくれてるみたいにh.r.contest
みたいに呼び出せるRepository
構造体を生やすとか
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repository
を生やすのはちょっと考えた方が良さそう、少なくともここではやらない
1文字のほうrenameします
う |
interfaces/handler/contest_test.go
Outdated
r := mock_repository.NewMockContestRepository(ctrl) | ||
mr := MockRepository{nil, nil, r, nil, nil} | ||
api := NewAPI(nil, nil, nil, nil, NewContestHandler(r), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MockRepository{Contest: r}
でよさそう
(下のNewAPI
がこの書き方になっちゃってるのも見にくいけど)
"github.com/gofrs/uuid" | ||
"github.com/labstack/echo/v4" | ||
"github.com/traPtitech/traPortfolio/usecases/repository" | ||
) | ||
|
||
type UserHandler struct { | ||
s service.UserService | ||
user repository.UserRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
それかMockRepositoryで実装してくれてるみたいにh.r.contest
みたいに呼び出せるRepository
構造体を生やすとか
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
close #431