import _find from 'lodash/find' ; import _isNil from 'lodash/isNil' ; import { TagToCoverResolver } from 'definitions' ; const resolver = async ( { id , cover } , _ , { dataSources : { articleService , systemService , tagService } } ) => { let coverId = cover ; if ( ! coverId ) { const articleCover = _find ( await tagService . findArticleCovers ( { id } ) , ( item ) => ! _isNil ( item . cover ) ) ; coverId = articleCover ?. cover ; } return coverId ? systemService . findAssetUrl ( coverId ) : null ; } ; export default resolver ;