|
1 | 1 | import {Promise} from 'es6-promise';
|
2 | 2 | import Repository from '../mocks/Repository';
|
3 |
| -import {SongsResponse} from '../models/responses/SongsResponse'; |
4 |
| -import {AlbumsResponse} from '../models/responses/AlbumsResponse'; |
5 |
| -import {ArtistsResponse} from '../models/responses/ArtistsResponse'; |
6 |
| -import {ArtistModel} from '../models/ArtistModel'; |
7 |
| -import {AlbumModel} from '../models/AlbumModel'; |
| 3 | +import {ISongsResponse} from '../models/responses/ISongsResponse'; |
| 4 | +import {IAlbumsResponse} from '../models/responses/IAlbumsResponse'; |
| 5 | +import {IArtistsResponse} from '../models/responses/IArtistsResponse'; |
| 6 | +import {IArtistModel} from '../models/IArtistModel'; |
| 7 | +import {IAlbumModel} from '../models/IAlbumModel'; |
8 | 8 |
|
9 | 9 | export default class MusicService {
|
10 |
| - static getAllSongs(): Promise<SongsResponse> { |
11 |
| - console.info('GET', '/songs'); |
12 |
| - |
| 10 | + public static getAllSongs(): Promise<ISongsResponse> { |
13 | 11 | return Repository.findAllSongs();
|
14 | 12 | }
|
15 | 13 |
|
16 |
| - static getSongsByAlbum(albumId: number) { |
17 |
| - console.info('GET', `/albums/${albumId}/songs`); |
18 |
| - |
| 14 | + public static getSongsByAlbum(albumId: number) { |
19 | 15 | return Repository.findSongsByAlbum(albumId);
|
20 | 16 | }
|
21 | 17 |
|
22 |
| - static getAllAlbums(): Promise<AlbumsResponse> { |
23 |
| - console.info('GET', '/albums'); |
24 |
| - |
| 18 | + public static getAllAlbums(): Promise<IAlbumsResponse> { |
25 | 19 | return Repository.findAllAlbums();
|
26 | 20 | }
|
27 | 21 |
|
28 |
| - static getAlbumsByArtist(artistId: number) { |
29 |
| - console.info('GET', `/artists/${artistId}/albums`); |
30 |
| - |
| 22 | + public static getAlbumsByArtist(artistId: number) { |
31 | 23 | return Repository.findAlbumsByArtist(artistId);
|
32 | 24 | }
|
33 | 25 |
|
34 |
| - static getSongsByArtist(artistId: number) { |
35 |
| - console.info('GET', `/artists/${artistId}/songs`); |
36 |
| - |
| 26 | + public static getSongsByArtist(artistId: number) { |
37 | 27 | return Repository.findSongsByArtist(artistId);
|
38 | 28 | }
|
39 | 29 |
|
40 |
| - static getAllArtists(): Promise<ArtistsResponse> { |
41 |
| - console.info('GET', '/artists'); |
42 |
| - |
| 30 | + public static getAllArtists(): Promise<IArtistsResponse> { |
43 | 31 | return Repository.findAllArtists();
|
44 | 32 | }
|
45 | 33 |
|
46 |
| - static getArtistById(id: number): Promise<ArtistModel> { |
47 |
| - console.info('GET', `/artists/${id}`); |
48 |
| - |
| 34 | + public static getArtistById(id: number): Promise<IArtistModel> { |
49 | 35 | return Repository.findArtistById(id);
|
50 | 36 | }
|
51 | 37 |
|
52 |
| - static getAlbumById(id: number): Promise<AlbumModel> { |
53 |
| - console.info('GET', `/albums/${id}`); |
54 |
| - |
| 38 | + public static getAlbumById(id: number): Promise<IAlbumModel> { |
55 | 39 | return Repository.findAlbumById(id);
|
56 | 40 | }
|
57 | 41 | }
|
0 commit comments