Skip to content

Commit

Permalink
Fixes improperly named filter parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Jun 4, 2019
1 parent 78e1913 commit 32f59f0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/resources/location.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ it('can get locations with additional parameters', async () => {
expect(mockAxios.get).toHaveBeenCalledTimes(1);
expect(mockAxios.get).toHaveBeenCalledWith('locations', {
params: {
'filter[assigned]': true,
'filter[assignments]': true,
'filter[invite_only]': 1,
'filter[service]': [1, 2],
'filter[user]': 1,
Expand Down
4 changes: 2 additions & 2 deletions src/resources/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface LocationFilter {
}

export interface LocationParameters {
assigned?: boolean;
assignments?: boolean;
invite_only?: number;
service?: number | number[] | string | string[];
user?: number | string;
Expand Down Expand Up @@ -114,7 +114,7 @@ export default class Location extends Conditional implements LocationResource {
const params: LocationParameters = {};

if (typeof this.filters.assigned !== 'undefined') {
params.assigned = this.filters.assigned;
params.assignments = this.filters.assigned;
}

if (typeof this.filters.invitable !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ it('can get services with additional parameters', async () => {
expect(mockAxios.get).toHaveBeenCalledTimes(1);
expect(mockAxios.get).toHaveBeenCalledWith('services', {
params: {
'filter[assigned]': true,
'filter[assignments]': true,
'filter[category]': 3,
'filter[invite_only]': 1,
'filter[location]': 1,
Expand Down
4 changes: 2 additions & 2 deletions src/resources/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ServiceFilter {
}

export interface ServiceParameters {
assigned?: boolean;
assignments?: boolean;
category?: number | string;
invite_only?: number;
location?: number | string;
Expand Down Expand Up @@ -124,7 +124,7 @@ export default class Service extends Conditional implements ServiceResource {
const params: ServiceParameters = {};

if (typeof this.filters.assigned !== 'undefined') {
params.assigned = this.filters.assigned;
params.assignments = this.filters.assigned;
}

if (typeof this.filters.category !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ it('can get users with additional parameters', async () => {
expect(mockAxios.get).toHaveBeenCalledTimes(1);
expect(mockAxios.get).toHaveBeenCalledWith('users', {
params: {
'filter[assigned]': true,
'filter[assignments]': true,
'filter[location]': 1,
'filter[service]': [1, 2],
limit: 5,
Expand Down
4 changes: 2 additions & 2 deletions src/resources/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface UserFilter {
}

export interface UserParameters {
assigned?: boolean;
assignments?: boolean;
service?: number | number[] | string | string[];
location?: number | string;
}
Expand Down Expand Up @@ -104,7 +104,7 @@ export default class User extends Conditional implements UserResource {
const params: UserParameters = {};

if (typeof this.filters.assigned !== 'undefined') {
params.assigned = this.filters.assigned;
params.assignments = this.filters.assigned;
}

if (typeof this.filters.services !== 'undefined') {
Expand Down

0 comments on commit 32f59f0

Please sign in to comment.