Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 server/src/controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import asyncHandler from "../utils/asyncHandler.js";
const sendResetEmail = async (email, token) => {
const transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST || 'smtp.gmail.com',
port: parseInt(process.env.EMAIL_PORT) || 587,
port: parseInt(process.env.EMAIL_PORT, 10) || 587,
auth: {
user: process.env.EMAIL_USER || process.env.EMAIL,
pass: process.env.EMAIL_PASS,
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/comment.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const getPostComments = asyncHandler(async (req, res) => {
}

const cursor = req.query.cursor || null;
const limit = Math.min(Math.max(parseInt(req.query.limit) || 20, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 20, 1), MAX_LIMIT);

let excludeUserIds = [];
if (req.user) {
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/message.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getMessages = asyncHandler(async (req, res) => {
}
}

const limit = Math.min(Math.max(parseInt(req.query.limit) || 50, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 50, 1), MAX_LIMIT);
const before = req.query.before;

let beforeId;
Expand Down
6 changes: 3 additions & 3 deletions server/src/controllers/post.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ poll = {

export const getPosts = asyncHandler(async (req, res) => {
const cursor = req.query.cursor;
const limit = Math.min(Math.max(parseInt(req.query.limit) || 10, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 10, 1), MAX_LIMIT);

let filter = { isDeleted: { $ne: true } };
if (req.user) {
Expand Down Expand Up @@ -372,7 +372,7 @@ export const searchPosts = asyncHandler(async (req, res) => {

const q = req.query.q?.trim();
const cursor = req.query.cursor;
const limit = Math.min(Math.max(parseInt(req.query.limit) || 10, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 10, 1), MAX_LIMIT);

if (!q) {
return res.status(200).json({ posts: [], limit, hasMore: false, nextCursor: null });
Expand Down Expand Up @@ -743,7 +743,7 @@ export const getPostsByUser = asyncHandler(async (req, res) => {


const cursor = req.query.cursor;
const limit = Math.min(Math.max(parseInt(req.query.limit) || 10, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 10, 1), MAX_LIMIT);

const likesPopulate = getLikesPopulate(excludeUserIds);

Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/review.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const createReview = asyncHandler(async (req, res) => {

export const getReviews = asyncHandler(async (req, res) => {
const cursor = req.query.cursor;
const limit = Math.min(Math.max(parseInt(req.query.limit) || 10, 1), MAX_LIMIT);
const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 10, 1), MAX_LIMIT);
const target = req.query.target;

let filter = {};
Expand Down