From 00b24efdc54436e737456fb76abb3d606a4917ec Mon Sep 17 00:00:00 2001 From: "Renato \"Lond\" Cerqueira" Date: Sat, 17 Dec 2016 14:13:25 +0100 Subject: [PATCH] Change the way trackId and albumId are set. --- lib/share.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/share.js b/lib/share.js index 930ce8a..5103392 100644 --- a/lib/share.js +++ b/lib/share.js @@ -60,8 +60,8 @@ export function findMatchesAsync(share) { console.log(match) if (match.id) { models.match.create({ - trackId: share.albumName ? share.id : null, - albumId: share.albumName ? null : share.id, + trackId: share.$modelOptions.name.singular == 'track' ? share.id : null, + albumId: share.$modelOptions.name.singular == 'album' ? share.id : null, externalId: match.id, service: match.service, name: match.name, @@ -72,8 +72,8 @@ export function findMatchesAsync(share) { }); } else { models.match.create({ - trackId: share.trackId ? share.id : null, - albumId: share.albumId ? share.id : null, + trackId: share.$modelOptions.name.singular == 'track' ? share.id : null, + albumId: share.$modelOptions.name.singular == 'album' ? share.id : null, externalId: null, service: match.service, name: null,