Skip to content

Commit f434c36

Browse files
authored
Merge pull request #1 from lakshaykamat/add-lyrics-to-song-model
Add Lyrics to the Song model
2 parents 0a8c537 + 8a5e761 commit f434c36

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

controllers/songController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const newSong = async (req, res) => {
9696

9797
const savedSongs = [];
9898

99-
for (const { name, artist, albumId, duration } of songsData) {
100-
const song = new Song({ name, artist, albumId, duration });
99+
for (const { name, artist, albumId, duration, lyrics } of songsData) {
100+
const song = new Song({ name, artist, albumId, duration, lyrics });
101101
const savedSong = await song.save();
102102

103103
const validAlbum = await Album.findById(albumId);

models/Song.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const songSchema = new mongoose.Schema({
1717
type: String,
1818
required: true,
1919
},
20+
lyrics: {
21+
type: String,
22+
required: true,
23+
},
2024
});
2125

2226
const Song = mongoose.model("Song", songSchema);

0 commit comments

Comments
 (0)