Merge branch 'master' into docs-draft

This commit is contained in:
Alexandre BODIN 2019-12-09 10:02:09 +01:00 committed by GitHub
commit ec6906c96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -493,7 +493,7 @@ sudo nano ecosystem.config.js
module.exports = { module.exports = {
apps : [{ apps : [{
name: 'your-app-name', name: 'your-app-name',
cwd: '/home/ubuntu/my-strapi-project/my-project' cwd: '/home/ubuntu/my-strapi-project/my-project',
script: 'npm', script: 'npm',
args: 'start', args: 'start',
env: { env: {

View File

@ -546,8 +546,8 @@ const buildSearchQuery = (qb, model, params) => {
case 'pg': { case 'pg': {
const searchQuery = searchText.map(attribute => const searchQuery = searchText.map(attribute =>
_.toLower(attribute) === attribute _.toLower(attribute) === attribute
? `to_tsvector(${attribute})` ? `to_tsvector(coalesce(${attribute}, ''))`
: `to_tsvector("${attribute}")` : `to_tsvector(coalesce("${attribute}", ''))`
); );
qb.orWhereRaw(`${searchQuery.join(' || ')} @@ plainto_tsquery(?)`, query); qb.orWhereRaw(`${searchQuery.join(' || ')} @@ plainto_tsquery(?)`, query);

View File

@ -16,11 +16,11 @@ module.exports = async (ctx, next) => {
if (isAdmin) { if (isAdmin) {
ctx.state.admin = await strapi ctx.state.admin = await strapi
.query('administrator', 'admin') .query('administrator', 'admin')
.findOne({ id }); .findOne({ id }, ['role']);
} else { } else {
ctx.state.user = await strapi ctx.state.user = await strapi
.query('user', 'users-permissions') .query('user', 'users-permissions')
.findOne({ id }); .findOne({ id }, ['role']);
} }
} catch (err) { } catch (err) {
return handleErrors(ctx, err, 'unauthorized'); return handleErrors(ctx, err, 'unauthorized');