From 99ccd3c9daf741d6b33294633c765f363bd1c5f2 Mon Sep 17 00:00:00 2001 From: Arup Rakshit Date: Fri, 10 Jan 2020 18:50:26 +0530 Subject: [PATCH] Fix the cancelTrip bug The issue is explained in the https://github.com/apollographql/fullstack-tutorial/issues/116. --- start/server/src/datasources/user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/start/server/src/datasources/user.js b/start/server/src/datasources/user.js index 46f762ecd..d51d9e350 100644 --- a/start/server/src/datasources/user.js +++ b/start/server/src/datasources/user.js @@ -57,7 +57,8 @@ class UserAPI extends DataSource { async cancelTrip({ launchId }) { const userId = this.context.user.id; - return !!this.store.trips.destroy({ where: { userId, launchId } }); + const numberOfDeletedTrips = await this.store.trips.destroy({ where: { userId, launchId } }); + return numberOfDeletedTrips !== 0; } async getLaunchIdsByUser() {