Skip to content

Commit ae14315

Browse files
committed
refactor: rename fromDB option for internal usage
1 parent b297a97 commit ae14315

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/services/ResourceBookingService.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ async function searchResourceBookings (currentUser, criteria, options) {
546546
if (!criteria.sortOrder) {
547547
criteria.sortOrder = 'desc'
548548
}
549-
if (!options.fromDb) {
549+
// this option to return data from DB is only for internal usage, and it cannot be passed from the endpoint
550+
if (!options.returnFromDB) {
550551
try {
551552
const esQuery = {
552553
index: config.get('esConfig.ES_INDEX_RESOURCE_BOOKING'),
@@ -849,7 +850,7 @@ searchResourceBookings.schema = Joi.object().keys({
849850
fromDb: Joi.boolean().default(false)
850851
}).default({
851852
returnAll: false,
852-
fromDb: false
853+
returnFromDB: false
853854
})
854855
}).required()
855856

src/services/WorkPeriodPaymentService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ async function createQueryWorkPeriodPayments (currentUser, criteria) {
405405
['id', 'billingAccountId', 'memberRate', 'customerRate', 'workPeriods.id', 'workPeriods.resourceBookingId', 'workPeriods.daysWorked', 'workPeriods.daysPaid'],
406406
_.map(_.keys(query), k => k === 'projectIds' ? 'projectId' : k))
407407
), ',')
408-
const searchResult = await searchResourceBookings(currentUser, _.extend({ fields, page: 1 }, query), { returnAll: true, fromDb: true })
408+
const searchResult = await searchResourceBookings(currentUser, _.extend({ fields, page: 1 }, query), { returnAll: true, returnFromDB: true })
409409

410410
const wpArray = _.flatMap(searchResult.result, 'workPeriods')
411411
const resourceBookingMap = _.fromPairs(_.map(searchResult.result, rb => [rb.id, rb]))

0 commit comments

Comments
 (0)