package logic import ( "context" "spark-server/internal/pkg/errs" ) func (s *Service) Pin(ctx context.Context, userID, friendID int64) error { return s.setPinned(ctx, userID, friendID, true) } func (s *Service) Unpin(ctx context.Context, userID, friendID int64) error { return s.setPinned(ctx, userID, friendID, false) } func (s *Service) setPinned(ctx context.Context, userID, friendID int64, pinned bool) error { if !s.ready() || userID <= 0 { return errs.ErrUnauthorized } if err := s.requireFriend(ctx, userID, friendID); err != nil { return err } return s.repo.SetPinned(ctx, userID, friendID, pinned) }