Skip to content

Commit

Permalink
Merge pull request #28 from asozialdotdev/login
Browse files Browse the repository at this point in the history
removed type checks which were throwing errors during login
  • Loading branch information
benjamindotdev authored Nov 1, 2024
2 parents 23dcdcd + c9153f6 commit d06e17b
Show file tree
Hide file tree
Showing 4 changed files with 5,900 additions and 615 deletions.
53 changes: 5 additions & 48 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions backend/src/routes/Users/updateUserLanguagesAndGithub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ export const updateUserLanguagesAndGithub = async (
try {
const { _id, codingLanguages, github } = req.body;

if (!mongoose.Types.ObjectId.isValid(_id)) {
return res.status(400).json({ error: "Invalid user ID" });
}
console.log(_id, codingLanguages, github);

if (!Array.isArray(codingLanguages) || typeof github !== 'string') {
return res.status(400).json({ error: "Invalid input data" });
}
// if (!mongoose.Types.ObjectId.isValid(_id)) {
// console.log("Invalid user ID");
// return res.status(400).json({ error: "Invalid user ID" });
// }

// if (!Array.isArray(codingLanguages)) {
// console.log("Invalid coding languages");
// return res.status(400).json({ error: "Invalid input data" });
// }

// if (typeof github !== "string") {
// console.log("Invalid github");
// return res.status(400).json({ error: "Invalid input data" });
// }

const updatedUser = await User.findByIdAndUpdate(
_id,
Expand Down
Loading

0 comments on commit d06e17b

Please sign in to comment.