mirror of
https://github.com/spacedeck/spacedeck-open.git
synced 2025-12-15 17:37:30 +01:00
allow looking up spaces via slug
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../models/db');
|
const db = require('../models/db');
|
||||||
|
const { Op } = require("sequelize");
|
||||||
var config = require('config');
|
var config = require('config');
|
||||||
|
|
||||||
module.exports = (req, res, next) => {
|
module.exports = (req, res, next) => {
|
||||||
@@ -53,8 +54,12 @@ module.exports = (req, res, next) => {
|
|||||||
'email': 1
|
'email': 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// find space by id or slug
|
||||||
db.Space.findOne({where: {
|
db.Space.findOne({where: {
|
||||||
"_id": spaceId
|
[Op.or]: [
|
||||||
|
{"_id": spaceId},
|
||||||
|
{"edit_slug": spaceId}
|
||||||
|
]
|
||||||
}}).then(function(space) {
|
}}).then(function(space) {
|
||||||
|
|
||||||
if (space) {
|
if (space) {
|
||||||
|
|||||||
Reference in New Issue
Block a user