Add access control (#65)

This commit is contained in:
Niklas Fondberg
2021-10-11 16:53:18 +02:00
committed by GitHub
parent 1d5d75d354
commit 640849de45
12 changed files with 382 additions and 35 deletions
+3 -1
View File
@@ -1,8 +1,10 @@
import { checkAccess } from '../cognito/access-control';
import { CategoryAPI } from '../datasources/category-api';
import { ProductAPI } from '../datasources/product-api';
const Category = {
async products({ id }, _args, { dataSources }) {
async products({ id }, _args, { dataSources, auth }) {
checkAccess(['products.read'], auth);
return (<ProductAPI>dataSources.productApi).getCategoryProducts(id);
},
};