@@ -10,14 +10,16 @@ import (
1010 "github.com/bastean/codexgo/v4/internal/app/server/service/errs"
1111 "github.com/bastean/codexgo/v4/internal/app/server/service/key"
1212 "github.com/bastean/codexgo/v4/internal/app/server/service/reply"
13- "github.com/bastean/codexgo/v4/internal/pkg/service/authentication/jwt"
14- "github.com/bastean/codexgo/v4/internal/pkg/service/communication/query"
15- "github.com/bastean/codexgo/v4/internal/pkg/service/errors"
16- "github.com/bastean/codexgo/v4/internal/pkg/service/module/user"
13+ "github.com/bastean/codexgo/v4/internal/pkg/adapter/query"
14+ "github.com/bastean/codexgo/v4/internal/pkg/service/authentication"
15+ "github.com/bastean/codexgo/v4/pkg/context/shared/domain/errors"
16+ "github.com/bastean/codexgo/v4/pkg/context/shared/domain/messages"
17+ "github.com/bastean/codexgo/v4/pkg/context/shared/infrastructure/authentications/jwt"
18+ "github.com/bastean/codexgo/v4/pkg/context/user/application/login"
1719)
1820
1921func Login (c * gin.Context ) {
20- attributes := new (user. LoginQueryAttributes )
22+ attributes := new (login. QueryAttributes )
2123
2224 err := c .BindJSON (attributes )
2325
@@ -26,25 +28,25 @@ func Login(c *gin.Context) {
2628 return
2729 }
2830
29- response , err := query .Bus .Ask (query .New (
30- user . LoginQueryKey ,
31+ response , err := query .Bus .Ask (messages .New (
32+ login . QueryKey ,
3133 attributes ,
32- new (user. LoginQueryMeta ),
34+ new (login. QueryMeta ),
3335 ))
3436
3537 if err != nil {
3638 errs .AbortByErr (c , errors .BubbleUp (err , "Login" ))
3739 return
3840 }
3941
40- found , ok := response .Attributes .(* user. LoginResponseAttributes )
42+ found , ok := response .Attributes .(* login. ResponseAttributes )
4143
4244 if ! ok {
4345 errs .AbortByErr (c , errs .Assertion ("Login" ))
4446 return
4547 }
4648
47- token , err := jwt .Generate (jwt.Payload {
49+ token , err := authentication . JWT .Generate (jwt.Payload {
4850 key .Exp : time .Now ().Add ((24 * time .Hour ) * 7 ).Unix (),
4951 key .UserID : found .ID ,
5052 })
0 commit comments