start upgrading eslint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 16:57:10 +02:00
parent 90c917f69e
commit 621787915c
304 changed files with 5992 additions and 6394 deletions

View File

@@ -4,7 +4,7 @@ import {
} from '../../../middlewares/auth';
import stripePayments from '../../../libs/payments/stripe';
let api = {};
const api = {};
/**
* @apiIgnore Payments are considered part of the private API
@@ -19,21 +19,23 @@ let api = {};
* @apiParam {String} coupon Query parameter - coupon for the matching subscription, required only for certain subscriptions
*
* @apiSuccess {Object} data Empty object
**/
* */
api.checkout = {
method: 'POST',
url: '/stripe/checkout',
middlewares: [authWithHeaders()],
async handler (req, res) {
// @TODO: These quer params need to be changed to body
let token = req.body.id;
let user = res.locals.user;
let gift = req.query.gift ? JSON.parse(req.query.gift) : undefined;
let sub = req.query.sub ? shared.content.subscriptionBlocks[req.query.sub] : false;
let groupId = req.query.groupId;
let coupon = req.query.coupon;
const token = req.body.id;
const { user } = res.locals;
const gift = req.query.gift ? JSON.parse(req.query.gift) : undefined;
const sub = req.query.sub ? shared.content.subscriptionBlocks[req.query.sub] : false;
const { groupId } = req.query;
const { coupon } = req.query;
await stripePayments.checkout({token, user, gift, sub, groupId, coupon});
await stripePayments.checkout({
token, user, gift, sub, groupId, coupon,
});
res.respond(200, {});
},
@@ -48,17 +50,17 @@ api.checkout = {
* @apiParam {String} id Body parameter - The token
*
* @apiSuccess {Object} data Empty object
**/
* */
api.subscribeEdit = {
method: 'POST',
url: '/stripe/subscribe/edit',
middlewares: [authWithHeaders()],
async handler (req, res) {
let token = req.body.id;
let groupId = req.body.groupId;
let user = res.locals.user;
const token = req.body.id;
const { groupId } = req.body;
const { user } = res.locals;
await stripePayments.editSubscription({token, groupId, user});
await stripePayments.editSubscription({ token, groupId, user });
res.respond(200, {});
},
@@ -69,16 +71,16 @@ api.subscribeEdit = {
* @api {get} /stripe/subscribe/cancel Cancel Stripe subscription
* @apiName StripeSubscribeCancel
* @apiGroup Payments
**/
* */
api.subscribeCancel = {
method: 'GET',
url: '/stripe/subscribe/cancel',
middlewares: [authWithHeaders()],
async handler (req, res) {
let user = res.locals.user;
let groupId = req.query.groupId;
const { user } = res.locals;
const { groupId } = req.query;
await stripePayments.cancelSubscription({user, groupId});
await stripePayments.cancelSubscription({ user, groupId });
if (req.query.noRedirect) {
res.respond(200);
@@ -92,7 +94,7 @@ api.handleWebhooks = {
method: 'POST',
url: '/stripe/webhooks',
async handler (req, res) {
await stripePayments.handleWebhooks({requestBody: req.body});
await stripePayments.handleWebhooks({ requestBody: req.body });
return res.respond(200, {});
},