From b2ba3c7c73f1f68fa9cead417435b986a64c5262 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 17 Oct 2020 21:24:25 +0530 Subject: [PATCH] Some more refactoring --- utils/domain-service.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/domain-service.js b/utils/domain-service.js index 76d511a0f..41aecef1a 100644 --- a/utils/domain-service.js +++ b/utils/domain-service.js @@ -1,7 +1,7 @@ const R = require('ramda'); const { cpanel } = require('./lib/cpanel'); -const { DOMAIN_DOMAIN, IS_TEST } = require('./constants'); -const { log, print, lazyTask, batchLazyTasks } = require('./helpers'); +const { DOMAIN_DOMAIN } = require('./constants'); +const { then, log, print, lazyTask, batchLazyTasks } = require('./helpers'); const BATCH_SIZE = 1; @@ -64,8 +64,8 @@ const executeBatch = (batches) => batches.reduce((promise, batch, index) => { }, Promise.resolve()); const getDomainService = ({ cpanel }) => { - const fetchZoneRecords = () => cpanel.zone.fetch().then(R.map(zoneToRecord)); - const fetchRedirections = () => cpanel.redirection.fetch().then(R.map(redirectionToRecord)); + const fetchZoneRecords = R.compose(then(R.map(zoneToRecord)), cpanel.zone.fetch); + const fetchRedirections = R.compose(then(R.map(redirectionToRecord)), cpanel.redirection.fetch); const addZoneRecord = lazyTask(R.compose( cpanel.zone.add,