message: Delete refresh token for /logout endpoint
diff: @@ -139,7 +139,51 @@ router.post('/refresh-token', async (req, res, next) => {
  });
  router.post('/logout', async (req, res, next) => {
  - // TODO: Remove current refresh token from DB
  + // get refresh token
  + const schema = Joi.object().keys({
  + refresh_token: Joi.string().uuid().required(),
  + });
  +
  + const { error, value } = schema.validate(req.body);
  +
  + const { refresh_token } = value;
  +
  + // delete refresh token passed in data
  + let mutation = `
  + mutation (
  + $refresh_token: uuid!,
  + ) {
  + delete_refresh_token: delete_${schema_name}refresh_tokens (
  + where: {
  + refresh_token: { _eq: $refresh_token }
  + }
  + ) {
  + affected_rows
  + }
  + }
  + `;
  +
  + let hasura_data;
  + try {
  + hasura_data = await graphql_client.request(mutation, {
  + user_id: user.id,
  + });
  + } catch (e) {
  + console.error(e);
  + // console.error('Error connection to GraphQL');
  + return next(Boom.unauthorized('Unable to delete refresh token'));
  + }
  +
  + // clear cookies
  + res.cookie('storage_jwt_token', '', {
  + maxAge: 0,
  + httpOnly: true,
  + });
  + res.cookie('refresh_token', '', {
  + maxAge: 0,
  + httpOnly: true,
  + });
  +
  res.send('OK');
  });
  