mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
22 lines
612 B
Go
22 lines
612 B
Go
|
package eventstore
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/caos/zitadel/internal/api/auth"
|
||
|
"github.com/caos/zitadel/internal/auth/repository/eventsourcing/view"
|
||
|
usr_model "github.com/caos/zitadel/internal/user/model"
|
||
|
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||
|
)
|
||
|
|
||
|
type UserSessionRepo struct {
|
||
|
View *view.View
|
||
|
}
|
||
|
|
||
|
func (repo *UserSessionRepo) GetMyUserSessions(ctx context.Context) ([]*usr_model.UserSessionView, error) {
|
||
|
userSessions, err := repo.View.UserSessionsByUserID(auth.GetCtxData(ctx).UserID)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return model.UserSessionsToModel(userSessions), nil
|
||
|
}
|