Files
pipu-music/services/api/internal/playback/social_activity.go
T
mrleo1nid 11a16cd023
ci / api / api (push) Canceled after 0s
ci / module boundaries / boundaries (push) Canceled after 0s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Canceled after 11m29s
ci / db / db (push) Canceled after 11m22s
ci / mobile / mobile (Metro-бандл Android) (push) Canceled after 6m43s
ci / recommender / recommender (push) Canceled after 6m47s
ci / ts / ts (packages + web) (push) Canceled after 1s
feat(social): add listening activity, shared rooms and modern chat
2026-10-23 10:45:40 +03:00

27 lines
800 B
Go

package playback
import (
"context"
"errors"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"pipu/api/internal/api/gen"
"pipu/api/internal/platform/apperr"
)
// ReadSocialPlaylist is a projection port for social after live activity authorization.
// DTO signing and reactions still use the requesting viewer's principal from ctx.
func (h *Handler) ReadSocialPlaylist(ctx context.Context, id uuid.UUID) (gen.Playlist, error) {
var owner uuid.UUID
e := h.store.pool.QueryRow(ctx, `SELECT user_id FROM playlists WHERE id=$1`, id).Scan(&owner)
if errors.Is(e, pgx.ErrNoRows) {
return gen.Playlist{}, apperr.NotFound("playlist.not_found", "playlist not found")
}
if e != nil {
return gen.Playlist{}, e
}
p, e := h.readPlaylist(ctx, owner, id, false)
p.ShareId = nil
return p, e
}