feat: Move ACL responsability to each Application Controller
This commit is contained in:
@@ -6,17 +6,17 @@ const { Account, User, Company, getUserById, getCompanyById, findUsersPage, find
|
||||
// Queries
|
||||
//////////////////////////////////////////////
|
||||
async function account( args, context ) {
|
||||
const account = new Account( context.graphQLContext.userId );
|
||||
const account = new Account( context.requestContext.userId );
|
||||
return account;
|
||||
}
|
||||
|
||||
async function profile( args, context ) {
|
||||
const profile = new User( context.graphQLContext.userId );
|
||||
const profile = new User( context.requestContext.userId );
|
||||
return profile;
|
||||
}
|
||||
|
||||
async function company( args, context ) {
|
||||
const company = new Company( context.graphQLContext.companyId );
|
||||
const company = new Company( context.requestContext.companyId );
|
||||
return company;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const schemaDescription = require('./graphql/schema.js');
|
||||
const schemaResolvers = require('./graphql/resolvers.js');
|
||||
|
||||
router.get('/test', async (req, res) => {
|
||||
console.log( req.graphQLContext );
|
||||
console.log( req.requestContext );
|
||||
res.status(200).send({
|
||||
msg : "It is alive!"
|
||||
});
|
||||
@@ -18,7 +18,7 @@ router.post( '/graphql',
|
||||
createHandler({
|
||||
schema: schemaDescription,
|
||||
rootValue : schemaResolvers,
|
||||
context: async (req, params) => { return { graphQLContext : req.raw.graphQLContext }; },
|
||||
context: async (req, params) => { return { requestContext : req.raw.requestContext }; },
|
||||
graphiql: true
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user