Skip to content

Commit 121dd86

Browse files
committed
fix: return null instead of 0 for song year and playCount
1 parent 6b31e67 commit 121dd86

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/modules/songs/helpers/song.helper.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export const createSongPayload = (song: z.infer<typeof SongAPIResponseModel>): z
77
id: song.id,
88
name: song.title,
99
type: song.type,
10-
year: song?.year || null,
10+
year: song.year || null,
1111
releaseDate: song.more_info?.release_date || null,
1212
duration: song.more_info?.duration ? Number(song.more_info?.duration) : null,
1313
label: song.more_info?.label || null,
1414
explicitContent: song.explicit_content === '1',
15-
playCount: Number(song.play_count || 0),
15+
playCount: song.play_count ? Number(song.play_count) : null,
1616
language: song.language,
1717
hasLyrics: song.more_info?.has_lyrics === 'true',
1818
lyricsId: song.more_info?.lyrics_id || null,

src/modules/songs/models/song.model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const SongModel = z.object({
6666
duration: z.number().nullable(),
6767
label: z.string().nullable(),
6868
explicitContent: z.boolean(),
69-
playCount: z.number(),
69+
playCount: z.number().nullable(),
7070
language: z.string(),
7171
hasLyrics: z.boolean(),
7272
lyricsId: z.string().nullable(),

0 commit comments

Comments
 (0)