Skip to content
Snippets Groups Projects
Commit 30bb8657 authored by otho's avatar otho
Browse files

fix(structure update): use correct regex to search same name

parent a014e16e
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,7 @@ export const hasAdminRightOnStructure = ({ userId, structureId }) => {
};
export const isAStructureWithSameNameExistWithSameParent = ({ name, parentId }) => {
const regExp = new RegExp(name, 'i');
const regExp = new RegExp(`^${name}$`, 'i');
const structuresWithSameNameOnSameLevel = Structures.find({ name: { $regex: regExp }, parentId });
return structuresWithSameNameOnSameLevel.count() > 0;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment