check for group name
This commit is contained in:
		@@ -11,6 +11,15 @@ const groupExists = async (req, res, next) => {
 | 
			
		||||
    next();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const groupNameExists = async (req, res, next) => {
 | 
			
		||||
    let groupName = req.params.groupName || req.body.groupName;
 | 
			
		||||
 | 
			
		||||
    let group = await GroupService.getByName(groupName);
 | 
			
		||||
 | 
			
		||||
    if (!group) throw new customError(`group does not exists`, responseCodes.responses.groups.name_not_found);
 | 
			
		||||
    next();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const localIdExists = async (req, res, next) => {
 | 
			
		||||
    let localId = req.params.localId || req.body.localId;
 | 
			
		||||
 | 
			
		||||
@@ -18,4 +27,5 @@ const localIdExists = async (req, res, next) => {
 | 
			
		||||
    next();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default { groupExists, localIdExists }
 | 
			
		||||
 | 
			
		||||
export default { groupExists, localIdExists, groupNameExists }
 | 
			
		||||
		Reference in New Issue
	
	Block a user