Migrated insert prop methods to nested sets

This commit is contained in:
ThaumRystra
2023-10-01 17:30:21 +02:00
parent fb7413dba4
commit e4590de3a7
6 changed files with 80 additions and 143 deletions

View File

@@ -1,5 +1,8 @@
import Creatures from '/imports/api/creature/creatures/Creatures';
export default function getRootCreatureAncestor(property) {
return Creatures.findOne(property.ancestors[0].id);
if (property.root?.collection !== 'creatures') {
throw 'Property does not have a root ancestor'
}
return Creatures.findOne(property.root.id);
}