madipo2611 0d4b8b203e v0.0.2
2025-05-01 12:17:42 +03:00

16 lines
299 B
Go

package graph
import (
"context"
"errors"
)
// getUserIDFromContext извлекает userID из контекста
func getUserIDFromContext(ctx context.Context) (int, error) {
userID, ok := ctx.Value("userID").(int)
if !ok {
return 0, errors.New("unauthorized")
}
return userID, nil
}