Inserting user ID to PostGraphile if available.
This commit is contained in:
parent
8e06d465cb
commit
7c7b38e869
|
@ -12,6 +12,12 @@ const { ActorPlugins, SitePlugins, ReleasePlugins } = require('./plugins/plugins
|
|||
|
||||
const connectionString = `postgres://${config.database.query.user}:${config.database.query.password}@${config.database.query.host}:5432/${config.database.query.database}`;
|
||||
|
||||
async function pgSettings(req) {
|
||||
return {
|
||||
'user.id': req.session.user?.id,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = postgraphile(
|
||||
connectionString,
|
||||
'public',
|
||||
|
@ -37,4 +43,5 @@ module.exports = postgraphile(
|
|||
...ReleasePlugins,
|
||||
],
|
||||
},
|
||||
pgSettings,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue