Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cori committed Oct 22, 2020
2 parents 0dabd0b + 58d2b17 commit 4dd2518
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ paths:
get:
description: >-
Get all resource roles. If isActive parameter is provided, filter the
results by isActive property.
results by the set properties.
tags:
- Resource Roles
security:
Expand All @@ -202,6 +202,18 @@ paths:
type: string
in: query
description: Filters the results based on the `name` property
- name: legacyId
type: number
in: query
description: Filters the results based on the `legacyId` property
- name: selfObtainable
type: boolean
in: query
description: Filters the results based on the `selfObtainable` property
- name: fullAccess
type: boolean
in: query
description: Filters the results based on the `fullAccess` property
responses:
'200':
description: OK - the request was successful
Expand Down
2 changes: 2 additions & 0 deletions src/services/ResourceRoleService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function getResourceRoles (criteria) {
let records = await helper.scan('ResourceRole')
if (criteria.name) records = _.filter(records, e => (criteria.name === e.name))
if (criteria.id) records = _.filter(records, e => (criteria.id === e.id))
if (criteria.legacyId) records = _.filter(records, e => (_.toNumber(criteria.legacyId) === _.toNumber(e.legacyId)))
if (!_.isUndefined(criteria.isActive)) records = _.filter(records, e => (e.isActive === (criteria.isActive === 'true')))
if (!_.isUndefined(criteria.selfObtainable)) records = _.filter(records, e => (e.selfObtainable === (criteria.selfObtainable === 'true')))
if (!_.isUndefined(criteria.fullAccess)) records = _.filter(records, e => (e.fullAccess === (criteria.fullAccess === 'true')))
Expand All @@ -33,6 +34,7 @@ getResourceRoles.schema = {
selfObtainable: Joi.boolean(),
fullAccess: Joi.boolean(),
id: Joi.id(),
legacyId: Joi.number(),
name: Joi.string()
}).required()
}
Expand Down

0 comments on commit 4dd2518

Please sign in to comment.