diff --git a/src/controllers/PublicController.ts b/src/controllers/PublicController.ts index abcddef..277f463 100644 --- a/src/controllers/PublicController.ts +++ b/src/controllers/PublicController.ts @@ -91,7 +91,14 @@ export default class PublicController { } } - Organization.find({ slugs: { '$in': slug } }).then(data => { + let findQuery: any = { slugs: { '$in': slug } } + + // allow to get organization with id + if (mongoose.Types.ObjectId.isValid(slug)) { + findQuery = { '_id': slug } + } + + Organization.find(findQuery).then(data => { if (data.length === 0) { return ErrorController.notFoundHandler()(req, res) } else {