This commit is contained in:
Belen Curcio
2017-06-26 14:39:10 -03:00
parent 59407e99d7
commit 2745245564
2 changed files with 5 additions and 8 deletions
+1 -3
View File
@@ -71,9 +71,7 @@ const findByUrl = async (context, asset_url) => {
throw errors.ErrInvalidAssetURL;
}
let asset = await AssetsService.findByUrl(asset_url);
return asset;
return AssetsService.findByUrl(asset_url);
};
/**
+4 -5
View File
@@ -53,11 +53,10 @@ const RootQuery = {
}
if (asset_url) {
return Assets.findByUrl(asset_url)
.then((asset) => {
const newQuery = Object.assign({}, query, {asset_id: asset.id});
return Comments.getCountByQuery(newQuery);
});
let asset = await Assets.findByUrl(asset_url);
if (asset) {
query.asset_id = asset.id;
}
}
return Comments.getCountByQuery(query);