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 = {
apps : [{
name: 'your-app-name',
cwd: '/home/ubuntu/my-strapi-project/my-project'
cwd: '/home/ubuntu/my-strapi-project/my-project',
script: 'npm',
args: 'start',
env: {

View File

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

View File

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