Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const createNewAuction = async (req, res) => {
const { initial_price: initialPrice, item_type: itemType, end_time: endTime, quantity } = req.body;

const { currencies } = await wallet.fetchWallet(seller);
const itemQuantity = parseInt(currencies[`${itemType}`]);
const itemQuantity = Number.parseInt(currencies[`${itemType}`]);
if (!itemQuantity || itemQuantity < quantity) return res.boom.forbidden(`You do not have enough of ${itemType}s!`);

const auctionId = await auctions.createNewAuction({ seller, initialPrice, itemType, endTime, quantity });
Expand Down
8 changes: 4 additions & 4 deletions controllers/discordactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ const deleteGroupRole = async (req, res) => {
const getPaginatedAllGroupRoles = async (req, res) => {
try {
const { page = 0, size = 10, dev } = req.query;
const limit = parseInt(size, 10) || 10;
const offset = parseInt(page, 10) * limit;
const limit = Number.parseInt(size, 10) || 10;
const offset = Number.parseInt(page, 10) * limit;

if (limit < 1 || limit > 100) {
return res.boom.badRequest("Invalid size. Must be between 1 and 100.");
Expand All @@ -139,8 +139,8 @@ const getPaginatedAllGroupRoles = async (req, res) => {
const { roles, total } = await discordRolesModel.getPaginatedGroupRolesByPage({ offset, limit });
const groupsWithMembershipInfo = await discordRolesModel.enrichGroupDataWithMembershipInfo(discordId, roles);

const nextPage = offset + limit < total ? parseInt(page, 10) + 1 : null;
const prevPage = page > 0 ? parseInt(page, 10) - 1 : null;
const nextPage = offset + limit < total ? Number.parseInt(page, 10) + 1 : null;
const prevPage = page > 0 ? Number.parseInt(page, 10) - 1 : null;

const baseUrl = `${req.baseUrl}${req.path}`;
const next = nextPage !== null ? `${baseUrl}?page=${nextPage}&size=${limit}&dev=true` : null;
Expand Down
2 changes: 1 addition & 1 deletion controllers/profileDiffs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getProfileDiffs = async (req, res) => {
const { profileDiffs, next } = await profileDiffsQuery.fetchProfileDiffsWithPagination(
status,
order,
parseInt(size),
Number.parseInt(size),
username,
cursor
);
Expand Down
8 changes: 4 additions & 4 deletions controllers/progresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ const getProgress = async (req, res) => {
try {
if (dev === "true") {
const { progressDocs, totalProgressCount } = await progressesModel.getPaginatedProgressDocument(req.query);
const limit = parseInt(size, 10);
const offset = parseInt(page, 10) * limit;
const nextPage = offset + limit < totalProgressCount ? parseInt(page, 10) + 1 : null;
const prevPage = page > 0 ? parseInt(page, 10) - 1 : null;
const limit = Number.parseInt(size, 10);
const offset = Number.parseInt(page, 10) * limit;
const nextPage = offset + limit < totalProgressCount ? Number.parseInt(page, 10) + 1 : null;
const prevPage = page > 0 ? Number.parseInt(page, 10) - 1 : null;
let baseUrl = `${req.baseUrl}`;
if (type) {
baseUrl += `?type=${type}`;
Expand Down
4 changes: 2 additions & 2 deletions controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ const filterUsers = async (req, res) => {
});
}
const { page, size } = req.query;
const pageNumber = parseInt(page) || 0;
const limitNumber = parseInt(size) || 100;
const pageNumber = Number.parseInt(page) || 0;
const limitNumber = Number.parseInt(size) || 100;
const skip = (pageNumber - 1) * limitNumber;

const users = await dataAccess.retreiveFilteredUsers(req.query, skip, limitNumber);
Expand Down
2 changes: 1 addition & 1 deletion utils/extensionRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const transformQuery = (size, status, dev = false) => {

let transformedSize;
if (size) {
transformedSize = parseInt(size);
transformedSize = Number.parseInt(size);
}
let transformedStatus;

Expand Down
4 changes: 2 additions & 2 deletions utils/progresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ const buildQueryToFetchPaginatedDocs = async (queryParams) => {
const { type, userId, taskId, orderBy, size = PROGRESSES_SIZE, page = PROGRESSES_PAGE_SIZE } = queryParams;
const orderByField = PROGRESS_VALID_SORT_FIELDS[0];
const isAscOrDsc = orderBy && PROGRESS_VALID_SORT_FIELDS[0] === orderBy ? "asc" : "desc";
const limit = parseInt(size, 10);
const offset = parseInt(page, 10) * limit;
const limit = Number.parseInt(size, 10);
const offset = Number.parseInt(page, 10) * limit;

let baseQuery;
if (type) {
Expand Down
4 changes: 2 additions & 2 deletions utils/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ const transformQuery = (status = "", size, page, assignee = "", title = "") => {
const transformedTitle = title;

if (page) {
query.page = parseInt(page);
query.page = Number.parseInt(page);
}

if (size) {
query.size = parseInt(size);
query.size = Number.parseInt(size);
}

return {
Expand Down
2 changes: 1 addition & 1 deletion utils/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const parseSearchQuery = (queryString) => {
searchParams.filterBy = value.toLowerCase();
break;
case "days":
searchParams.days = parseInt(value);
searchParams.days = Number.parseInt(value);
break;
default:
break;
Expand Down
Loading