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
5 changes: 5 additions & 0 deletions server/models/Item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
findRecent: async () => [],
findFeatured: async () => []
Comment on lines +2 to +3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods findRecent and findFeatured are defined as asynchronous but return static, empty arrays. This is not typical use of asynchronous functions, which are generally used for operations that involve I/O, like database interactions.

Recommendation: If these methods are intended to interact with a database in the future, consider implementing the actual database queries now, or if they should remain simple, remove the async keyword until it's necessary. This will avoid confusion and potential misuse of the methods.

};

3 changes: 2 additions & 1 deletion server/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ router.post('/register', async (req, res) => {
errors.push({ msg: 'Username must be between 3 and 20 characters' });
}

if (username && !/^[a-zA-Z0-9_-]+$/.test(username)) {
// Ensure the entire username only contains allowed characters
if (username && !/^[a-zA-Z0-9_-]+$/u.test(username)) {
errors.push({ msg: 'Username can only contain letters, numbers, underscores, and hyphens' });
}

Expand Down