Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
Merged

Tests #186

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
27 changes: 0 additions & 27 deletions src/controllers/GroupController.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
import Group from '../models/Group.js';

export const searchGroups = async (req, res) => {
try {
const { query, limit } = req.query;

if (!query || query.trim().length === 0) {
return res.status(400).json({
success: false,
error: 'Search query is required'
});
}

const groups = await Group.searchByName(query.trim(), parseInt(limit) || 10);

res.json({
success: true,
groups
});
} catch (error) {
console.error('Error searching groups:', error);
res.status(500).json({
success: false,
error: error.message
});
}
};


export const joinGroup = async (req, res) => {
try {
const { gID } = req.params;
Expand Down
4 changes: 0 additions & 4 deletions src/routes/groupRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
createGroup,
getGroupDetails,
deleteGroup,
searchGroups,
joinGroup,
requestToJoinGroup,
approvePendingMember,
Expand All @@ -25,9 +24,6 @@ const router = express.Router();
// Get popular groups sorted by member count
router.get('/popular', getPopularGroups);

// Search groups
router.get('/search', searchGroups);

// Get groups by genre tags
router.get('/by-genres', getGroupsByGenres);

Expand Down
Loading