generated from VLADIMIR/template
up
This commit is contained in:
@@ -159,3 +159,18 @@ func (s *server) SetGameMusic(ctx context.Context, req *proto.SetGameMusicReq) (
|
||||
}
|
||||
return &proto.SetGameMusicRsp{State: mapMusicState(state)}, nil
|
||||
}
|
||||
|
||||
func (s *server) ReorderPlaylistTracks(ctx context.Context, req *proto.ReorderPlaylistTracksReq) (*proto.ReorderPlaylistTracksRsp, error) {
|
||||
if !canManagePlaylists(ctx) {
|
||||
return nil, status.Error(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
ids := make([]int, len(req.GetTrackIDs()))
|
||||
for i, id := range req.GetTrackIDs() {
|
||||
ids[i] = int(id)
|
||||
}
|
||||
item, err := s.playlistService.Reorder(ctx, int(req.GetPlaylistID()), ids)
|
||||
if err != nil {
|
||||
return nil, playlistErrorStatus(err, "не удалось сохранить порядок треков")
|
||||
}
|
||||
return &proto.ReorderPlaylistTracksRsp{Playlist: mapPlaylist(item)}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user