How to use the entities.PlaylistSong.fromSong function in entities

To help you get started, we’ve selected a few entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mgm-interns / team-radio / server / src / subscription / station / RealTimeStationManager.ts View on Github external
protected async onAddedSong(payload: StationTopic.AddPlaylistSongPayLoad) {
    // Filter by stationId
    if (payload.stationId === this.stationId) {
      // Check if the song is already in the list
      if (!this.player.playlist.some(song => song.id === payload.song.id)) {
        this.player.playlist = [...this.player.playlist, PlaylistSong.fromSong(payload.song)];
        if (!this.player.playing) {
          await this.publish(StationTopic.UPDATE_PLAYER_SONG, { song: null });
          setTimeout(this.startPlayer.bind(this), 5000);
        }
      }
    }
  }
github mgm-interns / team-radio / server / src / services / crud / song / PlaylistSongCRUDService.ts View on Github external
downVotes?: string[]
  ): Promise {
    const song = await super.update(
      id,
      songId,
      title,
      url,
      creatorId,
      stationId,
      duration,
      thumbnail,
      isPlayed,
      upVotes,
      downVotes
    );
    return PlaylistSong.fromSong(song);
  }
github mgm-interns / team-radio / server / src / services / crud / song / PlaylistSongCRUDService.ts View on Github external
public async delete(id: string): Promise {
    const song = await super.delete(id);
    return PlaylistSong.fromSong(song);
  }
github mgm-interns / team-radio / server / src / services / crud / song / PlaylistSongCRUDService.ts View on Github external
public async findOne(id?: string): Promise {
    const song = await super.findOne(id);
    return PlaylistSong.fromSong(song);
  }