Adding tracknumber, adding sorting
Some checks failed
Music Collection CI Workflow / test (./frontend) (push) Successful in 36s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/msuic-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped
Music Collection CI Workflow / deploy (push) Has been skipped
Music Collection CI Workflow / test (./backend) (push) Failing after 29s
Some checks failed
Music Collection CI Workflow / test (./frontend) (push) Successful in 36s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/msuic-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped
Music Collection CI Workflow / deploy (push) Has been skipped
Music Collection CI Workflow / test (./backend) (push) Failing after 29s
This commit is contained in:
parent
13ec515d97
commit
fa3daa831f
@ -13,7 +13,11 @@ export class AlbumService {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
findAll(): Promise<Album[]> {
|
findAll(): Promise<Album[]> {
|
||||||
return this.albumRepository.find();
|
return this.albumRepository.find({
|
||||||
|
order: {
|
||||||
|
artist: "ASC"
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
findOneById(id: number): Promise<Album | null> {
|
findOneById(id: number): Promise<Album | null> {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export class CreateSongDto {
|
export class CreateSongDto {
|
||||||
title: string;
|
title: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
|
trackNumber: number;
|
||||||
albumId: number;
|
albumId: number;
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,6 @@ export class UpdateSongDto {
|
|||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
|
trackNumber: number;
|
||||||
albumId: number;
|
albumId: number;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ export class Song {
|
|||||||
@Column()
|
@Column()
|
||||||
duration: number
|
duration: number
|
||||||
|
|
||||||
|
@Column
|
||||||
|
trackNumber: number
|
||||||
|
|
||||||
@ManyToOne(() => Album, (album) => album.songs)
|
@ManyToOne(() => Album, (album) => album.songs)
|
||||||
album: Album
|
album: Album
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,11 @@ export class SongService {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
findAll(): Promise<Song[]> {
|
findAll(): Promise<Song[]> {
|
||||||
return this.songRepository.find();
|
return this.songRepository.find({
|
||||||
|
order: {
|
||||||
|
trackNumber: "ASC"
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
findOneById(id: number): Promise<Song | null> {
|
findOneById(id: number): Promise<Song | null> {
|
||||||
@ -23,7 +27,8 @@ export class SongService {
|
|||||||
async create(createSongDto: CreateSongDto): Promise<number> {
|
async create(createSongDto: CreateSongDto): Promise<number> {
|
||||||
const song = this.songRepository.create({
|
const song = this.songRepository.create({
|
||||||
title: createSongDto.title,
|
title: createSongDto.title,
|
||||||
duration: createSongDto.duration
|
duration: createSongDto.duration,
|
||||||
|
trackNumber: createSongDto.trackNumber
|
||||||
});
|
});
|
||||||
const savedSong = await this.songRepository.save(song);
|
const savedSong = await this.songRepository.save(song);
|
||||||
return savedSong.id;
|
return savedSong.id;
|
||||||
@ -37,7 +42,8 @@ export class SongService {
|
|||||||
|
|
||||||
await this.songRepository.update({ id: updateSongDto.id }, {
|
await this.songRepository.update({ id: updateSongDto.id }, {
|
||||||
title: updateSongDto.title,
|
title: updateSongDto.title,
|
||||||
duration: updateSongDto.duration
|
duration: updateSongDto.duration,
|
||||||
|
trackNumber: createSongDto.trackNumber
|
||||||
});
|
});
|
||||||
return "Song updated successfully";
|
return "Song updated successfully";
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,6 +58,7 @@ export default function Page() {
|
|||||||
<table className="u-full-width">
|
<table className="u-full-width">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Duration</th>
|
<th>Duration</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -65,6 +66,7 @@ export default function Page() {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{album.songs.map((song: Song) => (
|
{album.songs.map((song: Song) => (
|
||||||
<tr key={song.id}>
|
<tr key={song.id}>
|
||||||
|
<td>{song.trackNumber}</td>
|
||||||
<td>{song.title}</td>
|
<td>{song.title}</td>
|
||||||
<td>{TimeUtils.fancyTimeFormat(song.duration)}</td>
|
<td>{TimeUtils.fancyTimeFormat(song.duration)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -4,5 +4,6 @@ export interface Song {
|
|||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
|
trackNumber: number;
|
||||||
album: Album;
|
album: Album;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user