From 764612b1251902d4649d8f4e64333a3ff0445bda Mon Sep 17 00:00:00 2001 From: lesion Date: Tue, 7 Jun 2022 21:13:12 +0200 Subject: [PATCH] minor --- server/api/controller/cohort.js | 5 ----- server/api/controller/event.js | 2 -- wp-plugin/oauth.php | 3 ++- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/server/api/controller/cohort.js b/server/api/controller/cohort.js index 5df1714b..34f8ea60 100644 --- a/server/api/controller/cohort.js +++ b/server/api/controller/cohort.js @@ -6,9 +6,6 @@ const Place = require('../models/place') const log = require('../../log') const dayjs = require('dayjs') -// const { sequelize } = require('../models/index') - - const { Op, Sequelize } = require('sequelize') const cohortController = { @@ -91,14 +88,12 @@ const cohortController = { } const events = await Event.findAll({ - logging: console.log, where, attributes: { exclude: ['likes', 'boost', 'userId', 'is_visible', 'createdAt', 'updatedAt', 'description', 'resources'] }, order: ['start_datetime'], include: [ - // { model: Resource, required: false, attributes: ['id'] }, { model: Tag, order: [Sequelize.literal('(SELECT COUNT("tagTag") FROM event_tags WHERE tagTag = tag) DESC')], diff --git a/server/api/controller/event.js b/server/api/controller/event.js index a09e5de0..3464747b 100644 --- a/server/api/controller/event.js +++ b/server/api/controller/event.js @@ -611,10 +611,8 @@ const eventController = { if (tags && places) { where[Op.or] = { placeId: places ? places.split(',') : [], - // '$tags.tag$': Sequelize.literal(`EXISTS (SELECT 1 FROM event_tags WHERE tagTag in ( ${Sequelize.QueryInterface.escape(tags)} ) )`) } } else if (tags) { - // where[Op.and] = Sequelize.literal(`EXISTS (SELECT 1 FROM event_tags WHERE eventId=event.id AND tagTag in (?))`) where[Op.and] = Sequelize.fn('EXISTS', Sequelize.literal('SELECT 1 FROM event_tags WHERE "event_tags"."eventId"="event".id AND "tagTag" in (?)')) replacements.push(tags) } else if (places) { diff --git a/wp-plugin/oauth.php b/wp-plugin/oauth.php index e243e333..e312fee6 100644 --- a/wp-plugin/oauth.php +++ b/wp-plugin/oauth.php @@ -14,7 +14,7 @@ function wpgancio_delete_post ($post_id) { $gancio_id = get_post_meta($post_id, 'wpgancio_gancio_id', TRUE); if ($gancio_id) { $http = _wp_http_get_object(); - $response = $http->request( "${instance_url}/api/event/${gancio_id}", array( + $http->request( "${instance_url}/api/event/${gancio_id}", array( 'method' => 'DELETE', 'headers' => array ( 'Authorization' => 'Bearer ' . get_option('wpgancio_token') @@ -30,6 +30,7 @@ function wpgancio_save_event ($post_id) { return sanitize_title($tag->name); } + // TODO: merge event tags with post tags $tmp_tags = get_the_terms( $event, 'event-tag' ); $tags = array_map('tagName', $tmp_tags);