feat: initial commit

This commit is contained in:
2025-02-22 09:42:15 +01:00
parent ee4a65b345
commit e6e5c9b04d
43 changed files with 1191 additions and 247 deletions

View File

@ -3,14 +3,14 @@ package context
import (
"context"
"github.com/markbates/goth"
"forge.cadoles.com/wpetit/clearcase/internal/core/model"
"github.com/pkg/errors"
)
const keyUser = "user"
func User(ctx context.Context) *goth.User {
user, ok := ctx.Value(keyUser).(*goth.User)
func User(ctx context.Context) *model.User {
user, ok := ctx.Value(keyUser).(*model.User)
if !ok {
panic(errors.New("no user in context"))
}
@ -18,6 +18,6 @@ func User(ctx context.Context) *goth.User {
return user
}
func SetUser(ctx context.Context, user *goth.User) context.Context {
func SetUser(ctx context.Context, user *model.User) context.Context {
return context.WithValue(ctx, keyUser, user)
}