Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Use take instead of first
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 18, 2020
1 parent 08a2c53 commit 75fc64f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/_staart/rest/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getAllGroupForUser = async (
if (await can(tokenUserId, SudoScopes.READ, "sudo"))
return paginatedResult(
await prisma.groups.findMany(queryParamsToSelect(queryParams)),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand All @@ -35,7 +35,7 @@ export const getAllUsersForUser = async (
if (await can(tokenUserId, SudoScopes.READ, "sudo"))
return paginatedResult(
await prisma.users.findMany(queryParamsToSelect(queryParams)),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand All @@ -47,7 +47,7 @@ export const getAllCouponsForUser = async (
if (await can(tokenUserId, SudoScopes.READ, "sudo"))
return paginatedResult(
await prisma.couponCodes.findMany(queryParamsToSelect(queryParams)),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down
8 changes: 4 additions & 4 deletions src/_staart/rest/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export const getGroupMembershipsForUser = async (
where: { groupId: groupId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -688,7 +688,7 @@ export const getGroupApiKeysForUser = async (
where: { groupId: groupId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -790,7 +790,7 @@ export const getGroupDomainsForUser = async (
where: { groupId: groupId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -937,7 +937,7 @@ export const getGroupWebhooksForUser = async (
where: { groupId: groupId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down
10 changes: 5 additions & 5 deletions src/_staart/rest/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const getMembershipsForUser = async (
where: { userId: dataUserId },
include: { group: true },
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -306,7 +306,7 @@ export const getUserAccessTokensForUser = async (
where: { userId: userId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -387,7 +387,7 @@ export const getUserSessionsForUser = async (
where: { userId: userId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -425,7 +425,7 @@ export const getUserIdentitiesForUser = async (
where: { userId: userId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
throw new Error(INSUFFICIENT_PERMISSION);
};
Expand Down Expand Up @@ -520,7 +520,7 @@ export const getAllEmailsForUser = async (
where: { userId: userId },
...queryParamsToSelect(queryParams),
}),
{ first: queryParams.first, last: queryParams.last }
{ take: queryParams.first, last: queryParams.last }
);
}
throw new Error(INSUFFICIENT_PERMISSION);
Expand Down

0 comments on commit 75fc64f

Please sign in to comment.