24 lines
840 B
TypeScript
24 lines
840 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
import { NowPlayingService } from './now-playing.service';
|
|
|
|
@ApiTags('now-playing')
|
|
@Controller('now-playing')
|
|
export class NowPlayingController {
|
|
constructor(private readonly nowPlayingService: NowPlayingService) {}
|
|
|
|
// Текущие треки по всем станциям, ключ — числовой id станции (как в каталоге).
|
|
@Get()
|
|
@ApiOperation({ summary: 'Текущие треки по всем станциям' })
|
|
async getAll() {
|
|
const list = await this.nowPlayingService.getAllNowPlaying();
|
|
return list.map((np) => ({
|
|
stationId: np.station.stationId,
|
|
name: np.station.name,
|
|
song: np.song,
|
|
artist: np.artist,
|
|
coverUrl: np.coverUrl,
|
|
}));
|
|
}
|
|
}
|