Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the packages, libraries to the latest. #2050

Merged
merged 18 commits into from
Jun 20, 2024
Merged
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
Prev Previous commit
Next Next commit
fix:remove the changes of trailing commas
  • Loading branch information
Abhay5855 committed Jun 20, 2024
commit 9b8a3869bd0c964fd595d9f8a25f0d5aa6e04d84
2 changes: 1 addition & 1 deletion controllers/cloudflareCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const purge = async (res, id, username, isSuperUser, userDetails) => {
await logsQuery.addLog(
logType.CLOUDFLARE_CACHE_PURGED,
{ userId: id, purgedFor: userDetails.user.id },
{ message: "Cache Purged" },
{ message: "Cache Purged" }
);
} else {
await logsQuery.addLog(logType.CLOUDFLARE_CACHE_PURGED, { userId: id }, { message: "Cache Purged" });
Expand Down
4 changes: 2 additions & 2 deletions controllers/discordactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
} catch (error) {
logger.error(`error getting user with matching discordId ${error.message}`);
}
}),
})
);

const totalNicknamesUpdated = { count: 0 };
Expand All @@ -290,7 +290,7 @@
const nickNameUpdatedUsers = [];
let counter = 0;
for (let i = 0; i < usersToBeEffected.length; i++) {
const { discordId, username, first_name: firstName } = usersToBeEffected[i];

Check warning on line 293 in controllers/discordactions.js

View workflow job for this annotation

GitHub Actions / build (20.11.x)

Variable Assigned to Object Injection Sink
try {
if (counter % 10 === 0 && counter !== 0) {
await new Promise((resolve) => setTimeout(resolve, 5500));
Expand All @@ -306,7 +306,7 @@
if (message) {
counter++;
totalNicknamesUpdated.count++;
nickNameUpdatedUsers.push(usersToBeEffected[i].id);

Check warning on line 309 in controllers/discordactions.js

View workflow job for this annotation

GitHub Actions / build (20.11.x)

Generic Object Injection Sink
}
}
} catch (error) {
Expand Down Expand Up @@ -366,7 +366,7 @@
{
roleid: role.id,
},
roleInFirestore.id,
roleInFirestore.id
);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion controllers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ const kickoutPeer = async (req, res) => {
addLog(
logType.EVENTS_REMOVE_PEER,
{ removed_by_id: req.userData.id, removed_by_username: req.userData.username },
{ ...payload, event_id: id, peer_name: peer.name },
{ ...payload, event_id: id, peer_name: peer.name }
);

return res.status(200).json({
Expand Down
8 changes: 4 additions & 4 deletions controllers/extensionRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const fetchExtensionRequests = async (req, res) => {

const allExtensionRequests = await extensionRequestsQuery.fetchPaginatedExtensionRequests(
{ taskId, status: transformedStatus, assignee },
{ cursor, order, size: transformedSize },
{ cursor, order, size: transformedSize }
);
return res.json({
message: "Extension Requests returned successfully!",
Expand Down Expand Up @@ -238,7 +238,7 @@ const getSelfExtensionRequests = async (req, res) => {
if (latestExtensionRequest.status === "APPROVED" || latestExtensionRequest.status === "DENIED") {
const logs = await logsQuery.fetchLogs(
{ "meta.extensionRequestId": latestExtensionRequest.id, limit: 1 },
"extensionRequests",
"extensionRequests"
);

if (
Expand Down Expand Up @@ -390,8 +390,8 @@ const updateExtensionRequestStatus = async (req, res) => {
promises.push(
tasks.updateTask(
{ endsOn: extensionRequest.extensionRequestData.newEndsOn },
extensionRequest.extensionRequestData.taskId,
),
extensionRequest.extensionRequestData.taskId
)
);
promises.push(addLog(taskLog.type, taskLog.meta, taskLog.body));
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/external-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const linkExternalAccount = async (req, res) => {
discordId: attributes.discordId,
discordJoinedAt: attributes.discordJoinedAt,
},
userId,
userId
);

return res.status(204).json({ message: "Your discord profile has been linked successfully" });
Expand Down
10 changes: 5 additions & 5 deletions controllers/staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const updateRoles = async (req, res) => {
},
updated_at: Date.now(),
},
userId,
userId
);
return res.status(200).json({
message: "Roles Updated successfully",
Expand Down Expand Up @@ -51,8 +51,8 @@ const removePrivileges = async (req, res) => {
},
updated_at: Date.now(),
},
member.id,
),
member.id
)
);
});
superUsers.forEach((superUser) => {
Expand All @@ -65,8 +65,8 @@ const removePrivileges = async (req, res) => {
},
updated_at: Date.now(),
},
superUser.id,
),
superUser.id
)
);
});

Expand Down
6 changes: 3 additions & 3 deletions controllers/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ const updateTaskStatus = async (req, res, next) => {
return res.boom.badRequest(
`The status of task can not be changed from ${
isCurrentTaskStatusInProgress ? "In progress" : "Blocked"
} until progress of task is not 100%.`,
} until progress of task is not 100%.`
);
}
if (isNewTaskStatusInProgress && !isCurrentTaskStatusBlock && !isCurrProgress0 && !isNewProgress0) {
return res.boom.badRequest(
"The status of task can not be changed to In progress until progress of task is not 0%.",
"The status of task can not be changed to In progress until progress of task is not 0%."
);
}
}
Expand Down Expand Up @@ -439,7 +439,7 @@ const overdueTasks = async (req, res) => {
const allTasks = await tasks.fetchTasks();
const now = Math.floor(Date.now() / 1000);
const overDueTasks = allTasks.filter(
(task) => (task.status === ASSIGNED || task.status === IN_PROGRESS) && task.endsOn < now,
(task) => (task.status === ASSIGNED || task.status === IN_PROGRESS) && task.endsOn < now
);
const newAvailableTasks = await tasks.overdueTasks(overDueTasks);
return res.json({
Expand Down
2 changes: 1 addition & 1 deletion controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ const rejectProfileDiff = async (req, res) => {
const { profileDiffId, message } = req.body;
const profileResponse = await profileDiffsQuery.updateProfileDiff(
{ approval: profileDiffStatus.REJECTED },
profileDiffId,
profileDiffId
);

if (profileResponse.notFound) return res.boom.notFound("Profile Diff doesn't exist");
Expand Down
2 changes: 1 addition & 1 deletion middlewares/contentTypeCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (req, res, next) => {
const notMultiPart = !contentType.includes("multipart/form-data");
if (notMultiPart) {
return res.boom.unsupportedMediaType(
`Invalid content-type header: ${contentType}, expected: application/json or multipart/form-data`,
`Invalid content-type header: ${contentType}, expected: application/json or multipart/form-data`
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions middlewares/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ const middleware = (app) => {
ieNoOpen: false,
referrerPolicy: false,
xssFilter: false,
}),
})
);

app.use(
cors({
origin: config.get("cors.allowedOrigins"),
credentials: true,
optionsSuccessStatus: 200,
}),
})
);
app.use(contentTypeCheck);

Expand Down
4 changes: 2 additions & 2 deletions middlewares/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ try {
},
(accessToken, refreshToken, profile, done) => {
return done(null, accessToken, profile);
},
),
}
)
);
} catch (err) {
logger.error("Error initialising passport:", err);
Expand Down
4 changes: 2 additions & 2 deletions middlewares/validators/extensionRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const getExtensionRequestsValidator = async (req, res, next) => {
joi
.string()
.valid(...ER_STATUS_ENUM)
.insensitive(),
),
.insensitive()
)
)
.optional(),
assignee: joi.alternatives().try(joi.string(), joi.array().items(joi.string())).optional(),
Expand Down
2 changes: 1 addition & 1 deletion middlewares/validators/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const validateItemsPayload = async (req, res, next) => {
Joi.object({
tagId: Joi.string().required(),
levelId: Joi.string().required(),
}),
})
),
});

Expand Down
4 changes: 2 additions & 2 deletions middlewares/validators/task-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const { RQLQueryParser } = require("../../utils/RQLParser");
const githubOrg = config.get("githubApi.org");
const githubBaseUrl = config.get("githubApi.baseUrl");
const githubIssuerUrlPattern = new RegExp(`^${githubBaseUrl}/repos/${githubOrg}/.+/issues/\\d+$`);

Check warning on line 6 in middlewares/validators/task-requests.js

View workflow job for this annotation

GitHub Actions / build (20.11.x)

Found non-literal argument to RegExp Constructor
const githubIssueHtmlUrlPattern = new RegExp(`^${GITHUB_URL}/${githubOrg}/.+/issues/\\d+$`); // Example: https://github.com/Real-Dev-Squad/website-status/issues/1050

Check warning on line 7 in middlewares/validators/task-requests.js

View workflow job for this annotation

GitHub Actions / build (20.11.x)

Found non-literal argument to RegExp Constructor
const { TASK_REQUEST_STATUS, TASK_REQUEST_TYPE } = require("../../constants/taskRequests");

const postTaskRequests = async (req, res, next) => {
Expand Down Expand Up @@ -68,7 +68,7 @@
joi.object().keys({
value: joi.string().valid(...Object.values(TASK_REQUEST_STATUS).map((value) => value.toLowerCase())),
operator: joi.string().optional(),
}),
})
)
.optional(),
"request-type": joi
Expand All @@ -77,7 +77,7 @@
joi.object().keys({
value: joi.string().valid(...Object.values(TASK_REQUEST_TYPE).map((value) => value.toLowerCase())),
operator: joi.string().optional(),
}),
})
)
.optional(),
});
Expand Down
12 changes: 6 additions & 6 deletions middlewares/validators/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const updateTask = async (req, res, next) => {

const updateSelfTask = async (req, res, next) => {
const validStatus = [...TASK_STATUS_ENUM, ...Object.values(TASK_STATUS_OLD)].filter(
(item) => item !== TASK_STATUS.AVAILABLE,
(item) => item !== TASK_STATUS.AVAILABLE
);
const schema = joi
.object()
Expand Down Expand Up @@ -176,7 +176,7 @@ const getTasksValidator = async (req, res, next) => {
joi.when("next", {
is: joi.exist(),
then: joi.custom((_, helpers) => helpers.message("Both prev and next cannot be passed")),
}),
})
),
size: joi.number().integer().positive().min(1).max(100).optional(),
q: joi
Expand Down Expand Up @@ -216,7 +216,7 @@ const getUsersValidator = async (req, res, next) => {
joi.object().keys({
value: joi.string().valid(...Object.values(tasksUsersStatus)),
operator: joi.string().valid(Operators.INCLUDE),
}),
})
)
.required(),
"days-count": joi
Expand All @@ -225,7 +225,7 @@ const getUsersValidator = async (req, res, next) => {
joi.object().keys({
value: joi.number().integer().min(1).max(10),
operator: joi.string().valid(Operators.EXCLUDE),
}),
})
)
.max(1)
.optional(),
Expand All @@ -235,7 +235,7 @@ const getUsersValidator = async (req, res, next) => {
joi.object().keys({
value: joi.string().valid(...Object.keys(daysOfWeek)),
operator: joi.string().valid(Operators.EXCLUDE),
}),
})
)
.max(7)
.optional(),
Expand All @@ -245,7 +245,7 @@ const getUsersValidator = async (req, res, next) => {
joi.object().keys({
value: joi.date().timestamp(),
operator: joi.string().valid(Operators.EXCLUDE),
}),
})
)
.max(20)
.optional(),
Expand Down
2 changes: 1 addition & 1 deletion middlewares/validators/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async function getUsers(req, res, next) {
joi.string().when("page", {
is: joi.exist(),
then: joi.custom((_, helpers) => helpers.message("Both page and prev can't be passed")),
}),
})
)
.messages({
"string.empty": "prev value cannot be empty",
Expand Down
10 changes: 5 additions & 5 deletions middlewares/validators/userStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const validateUserStatusData = async (todaysTime, req, res, next) => {
.required()
.error(
new Error(
`The 'until' field must have a value that is either 'from' date or a date that comes after 'from' day.`,
),
`The 'until' field must have a value that is either 'from' date or a date that comes after 'from' day.`
)
),
otherwise: Joi.optional(),
}),
Expand All @@ -39,12 +39,12 @@ const validateUserStatusData = async (todaysTime, req, res, next) => {
is: Joi.number().greater(
Joi.ref("from", {
adjust: (value) => value + threeDaysInMilliseconds,
}),
})
),
then: Joi.string()
.optional()
.error(
new Error(`The value for the 'message' field is mandatory when State is OOO for more than three days.`),
new Error(`The value for the 'message' field is mandatory when State is OOO for more than three days.`)
),
otherwise: Joi.required(),
}),
Expand Down Expand Up @@ -94,7 +94,7 @@ const validateMassUpdate = async (req, res, next) => {
Joi.object({
userId: Joi.string().trim().required(),
state: Joi.string().valid(userState.IDLE, userState.ACTIVE).required(),
}),
})
)
.min(1)
.required()
Expand Down
2 changes: 1 addition & 1 deletion models/badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function removeBadges({ userId, badgeIds }) {
const documentRefferences = snapshot.docs.map((doc) => doc.ref);
const documentsRefferencesChunks = chunks(documentRefferences, DOCUMENT_WRITE_SIZE);
const bulkWriterBatches = documentsRefferencesChunks.map((value) =>
assignOrRemoveBadgesInBulk({ userId, array: value, isRemove: true }),
assignOrRemoveBadgesInBulk({ userId, array: value, isRemove: true })
);
return await Promise.all(bulkWriterBatches);
} catch (err) {
Expand Down
Loading
Loading