Skip to content

Commit

Permalink
Merge pull request #403 from wellcomecollection/rk/add-patron-type
Browse files Browse the repository at this point in the history
Add new StaffWithRestricted patron type
  • Loading branch information
kenoir authored Jun 10, 2024
2 parents 547e2fc + b5170a4 commit ceb60c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/shared/sierra-client/src/patron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export function toPatronRecord(response: PatronResponse): PatronRecord {
};
}

export type Role = 'Reader' | 'Staff' | 'SelfRegistered' | 'Excluded';
export type Role =
| 'Reader'
| 'Staff'
| 'SelfRegistered'
| 'Excluded'
| 'StaffWithRestricted';

// You can find an up-to-date list of patronType codes and descriptions
// in the Sierra API at: /v5/patrons/metadata
Expand All @@ -41,6 +46,8 @@ const patronTypeToRole = (patronType: number): Role => {
case 19: // Exhibitions & Events
case 22: // Conservation
return 'Staff';
case 9: // Wellcome Collection Staff - including access to restricted items
return 'StaffWithRestricted';
case 29: // Self Registered
return 'SelfRegistered';
case 6: // Excluded
Expand Down
1 change: 1 addition & 0 deletions packages/shared/sierra-client/tests/patron.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ describe('toPatronRecord', () => {
test.each([
{ patronType: 7, role: 'Reader' },
{ patronType: 8, role: 'Staff' },
{ patronType: 9, role: 'StaffWithRestricted' },
{ patronType: 29, role: 'SelfRegistered' },
{ patronType: 6, role: 'Excluded' },
])('maps patronType $patronType to role $role', ({ patronType, role }) => {
Expand Down

0 comments on commit ceb60c2

Please sign in to comment.