feat(Public): allow to fetch orgs by id
This commit is contained in:
parent
844244b90a
commit
2b471034da
1 changed files with 8 additions and 1 deletions
|
@ -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) {
|
if (data.length === 0) {
|
||||||
return ErrorController.notFoundHandler()(req, res)
|
return ErrorController.notFoundHandler()(req, res)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue