| Current Path : /proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/graphql/schema/ |
| Current File : //proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/graphql/schema/api-key.schema.js |
const auth = require('../../services/auth.js');
// Import dependencies
const { apiKeyTC } = require('../types/api-key.type.js');
// RELATIONS =========================================
// RESOLVERS =========================================
// QUERIES ===========================================
const apiKeyQuery = {
...auth.authenticationRequired({
apiKeyById: apiKeyTC.mongooseResolvers.findById(),
apiKeyMany: apiKeyTC.mongooseResolvers.findMany(),
}),
};
// MUTATIONS =========================================
const apiKeyMutation = {
...auth.authenticationRequired(
auth.superAdminRequired(
auth.apiKeyHashWrapper({
apiKeyCreateOne: apiKeyTC.mongooseResolvers.createOne(),
apiKeyCreateMany: apiKeyTC.mongooseResolvers.createMany(),
}),
),
),
...auth.authenticationRequired(
auth.superAdminRequired(
auth.apiKeySetActualKeyHash({
apiKeyUpdateById: apiKeyTC.mongooseResolvers.updateById(),
apiKeyUpdateMany: apiKeyTC.mongooseResolvers.updateMany(),
}),
),
),
};
// EXPORTS =========================================
module.exports = {
apiKeyQuery,
apiKeyMutation,
};