diff --git a/go.mod b/go.mod index d94889f..2f2a58d 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require github.com/mattn/go-sqlite3 v1.14.24 require ( github.com/L4B0MB4/EVTSRC v0.5.3 // indirect - github.com/PRYVT/utils v0.3.0 // indirect + github.com/PRYVT/utils v0.4.0 // indirect github.com/bytedance/sonic v1.12.2 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect diff --git a/go.sum b/go.sum index 8b0c771..aaec914 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,8 @@ github.com/PRYVT/utils v0.2.1 h1:GiTbziM3lqRLc4EWGV28+T/aKaY+B80KTqnkBklf9q0= github.com/PRYVT/utils v0.2.1/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w= github.com/PRYVT/utils v0.3.0 h1:E0q08Gba+TdIsflKBA2XJLEE/RqbB8u3oXxy1wM7l+s= github.com/PRYVT/utils v0.3.0/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w= +github.com/PRYVT/utils v0.4.0 h1:RQ7u6sunsic1EfZqOiaZDZvPEJwyx/DlPWqdFlgZHwM= +github.com/PRYVT/utils v0.4.0/go.mod h1:G48oYenFuXUKVVA0sE/lmJlOwHGRacKH/9dNNae0DTk= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic v1.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg= diff --git a/pkg/query/eventhandling/user.go b/pkg/query/eventhandling/user.go index bab128c..001d20b 100644 --- a/pkg/query/eventhandling/user.go +++ b/pkg/query/eventhandling/user.go @@ -4,6 +4,7 @@ import ( "github.com/L4B0MB4/EVTSRC/pkg/models" "github.com/L4B0MB4/PRYVT/identification/pkg/aggregates" "github.com/L4B0MB4/PRYVT/identification/pkg/query/store/repository" + "github.com/PRYVT/utils/pkg/interfaces" "github.com/google/uuid" "github.com/rs/zerolog/log" ) @@ -18,6 +19,10 @@ func NewUserEventHandler(userRepo *repository.UserRepository) *UserEventHandler } } +func (eh *UserEventHandler) AddWebsocketConnection(conn interfaces.WebsocketConnecter) { + log.Warn().Msg("Websocket connection not yet supported for user events") +} + func (eh *UserEventHandler) HandleEvent(event models.Event) error { if event.AggregateType == "user" { ua, err := aggregates.NewUserAggregate(uuid.MustParse(event.AggregateId)) diff --git a/pkg/query/httphandler/controller/user_controller.go b/pkg/query/httphandler/controller/user_controller.go index 89ff9d7..6a5e3b8 100644 --- a/pkg/query/httphandler/controller/user_controller.go +++ b/pkg/query/httphandler/controller/user_controller.go @@ -2,6 +2,7 @@ package controller import ( "net/http" + "time" "github.com/L4B0MB4/PRYVT/identification/pkg/aggregates" models "github.com/L4B0MB4/PRYVT/identification/pkg/models/query" @@ -41,7 +42,7 @@ func (ctrl *UserController) GetToken(c *gin.Context) { c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"}) return } - token, err := auth.CreateToken(userUuid) + token, err := auth.CreateToken(userUuid, 12*time.Hour) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return @@ -56,7 +57,7 @@ func (ctrl *UserController) RefreshToken(c *gin.Context) { c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"}) return } - token, err := auth.CreateToken(userUuid) + token, err := auth.CreateToken(userUuid, 12*time.Hour) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})