allow looking up spaces via slug

This commit is contained in:
mntmn
2020-05-11 18:25:44 +02:00
committed by mntmn
parent b99ec300bb
commit f6cfef899e

View File

@@ -1,6 +1,7 @@
'use strict';
const db = require('../models/db');
const { Op } = require("sequelize");
var config = require('config');
module.exports = (req, res, next) => {
@@ -53,8 +54,12 @@ module.exports = (req, res, next) => {
'email': 1
};
// find space by id or slug
db.Space.findOne({where: {
"_id": spaceId
[Op.or]: [
{"_id": spaceId},
{"edit_slug": spaceId}
]
}}).then(function(space) {
if (space) {