Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If not DB ids - load entities by slugs
if (!EntityClass.isId(value)) {
if (typeof value === "string") {
query = { slug: value };
} else if (value.id) {
query = { id: value.id };
} else if (value.slug) {
query = { slug: value.slug };
}
}
// TODO: ne bi htio loadati entitet tu jer to je samo populate
entities[i] = await EntityClass.findOne({ query });
}
return new EntityCollection(entities.filter(Boolean));
}
return entities;
};
};