Skip to content

Commit 8b55765

Browse files
committed
fix: checking if member of project
1 parent 6a894b7 commit 8b55765

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/services/WorkPeriodService.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ async function getWorkPeriod (currentUser, id, fromDb = false) {
177177
if (!resourceBooking.body.hits.total.value) {
178178
throw new errors.NotFoundError()
179179
}
180-
await _checkUserPermissionForGetWorkPeriod(currentUser, resourceBooking.body.hits.hits[0]._source.workPeriods.projectId) // check user permission
181-
return _.find(resourceBooking.body.hits.hits[0]._source.workPeriods, { id })
180+
const workPeriod = _.find(resourceBooking.body.hits.hits[0]._source.workPeriods, { id })
181+
await _checkUserPermissionForGetWorkPeriod(currentUser, workPeriod.projectId) // check user permission
182+
return workPeriod
182183
} catch (err) {
183184
if (helper.isDocumentMissingException(err)) {
184185
throw new errors.NotFoundError(`id: ${id} "WorkPeriod" not found`)

0 commit comments

Comments
 (0)