Fixed issues with IA utils, continued work on playlist mgmt UI
This commit is contained in:
parent
3da88aea2a
commit
f4db10fbc3
7 changed files with 142 additions and 56 deletions
|
|
@ -46,6 +46,7 @@ playlistMediaProperties.pre('save', async function (next){
|
|||
});
|
||||
|
||||
//methods
|
||||
//Rehydrate to a full phat media object
|
||||
playlistMediaProperties.methods.rehydrate = function(){
|
||||
//Return item as a full phat, standard media object
|
||||
return new media(
|
||||
|
|
@ -58,4 +59,14 @@ playlistMediaProperties.methods.rehydrate = function(){
|
|||
);
|
||||
}
|
||||
|
||||
//Dehydrate to minified flat network-friendly object
|
||||
playlistMediaProperties.methods.dehydrate = function(){
|
||||
return {
|
||||
title: this.title,
|
||||
url: this.url,
|
||||
duration: this.duration,
|
||||
uuid: this.uuid.toString()
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = mediaSchema.discriminator('saved', playlistMediaProperties);
|
||||
|
|
@ -41,11 +41,7 @@ playlistSchema.methods.dehydrate = function(){
|
|||
|
||||
//Fill media array
|
||||
for(let media of this.media){
|
||||
mediaArray.push({
|
||||
title: media.title,
|
||||
url: media.url,
|
||||
duration: media.duration
|
||||
});
|
||||
mediaArray.push(media.dehydrate());
|
||||
}
|
||||
|
||||
//return dehydrated playlist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue