package session import ( "context" "errors" "tug/internal/storage" ) func (s *Service) LinkGoogle(ctx context.Context, p Principal, subject string) (storage.GoogleLink, error) { return s.store.LinkGoogleAudited(ctx, storage.CreateGoogleLinkInput{UserID: p.UserID, GoogleSub: subject}, p.SessionID, p.UserID) } func (s *Service) UnlinkGoogle(ctx context.Context, p Principal) (storage.GoogleLink, storage.Revoked, error) { return s.store.UnlinkGoogleAudited(ctx, p.UserID, p.SessionID, p.UserID) } func (s *Service) GoogleLink(ctx context.Context, userID string) (*storage.GoogleLink, error) { link, err := s.store.GoogleLinkByUser(ctx, userID) switch { case errors.Is(err, storage.ErrNotFound): return nil, nil case err != nil: return nil, failure("google link", err) } return &link, nil }