mirror of
https://github.com/strapi/strapi.git
synced 2025-10-26 23:51:10 +00:00
Merge branch 'master' into docs-draft
This commit is contained in:
commit
ec6906c96c
@ -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: {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user