Skip to content

Commit c265893

Browse files
Merge pull request #242 from cuappdev/jiwon/auth-bug
update schema
2 parents df256bb + e3c5dd8 commit c265893

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/schema.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def resolve_total_gym_days(self, info):
293293
def resolve_active_streak(self, info):
294294
user = User.get_query(info).filter(UserModel.id == self.id).first()
295295
if not user:
296-
raise GraphQLError("User with the given ID does not exist.")
296+
return self.active_streak
297297

298298
workout_date_rows = (
299299
Workout.get_query(info)
@@ -355,7 +355,7 @@ def resolve_active_streak(self, info):
355355
def resolve_streak_start(self, info):
356356
user = User.get_query(info).filter(UserModel.id == self.id).first()
357357
if not user:
358-
raise GraphQLError("User with the given ID does not exist.")
358+
return None
359359

360360
workout_date_rows = (
361361
Workout.get_query(info)
@@ -450,7 +450,7 @@ def goal_for_window_start(ws_date):
450450
def resolve_max_streak(self, info):
451451
user = User.get_query(info).filter(UserModel.id == self.id).first()
452452
if not user:
453-
raise GraphQLError("User with the given ID does not exist.")
453+
return self.max_streak
454454

455455
workout_date_rows = (
456456
Workout.get_query(info)
@@ -1221,6 +1221,8 @@ def mutate(self, info, user_id):
12211221
raise GraphQLError(f"S3 error: {type(e).__name__}: {e}")
12221222

12231223
db_session.delete(user)
1224+
db_session.flush()
1225+
db_session.expunge(user)
12241226
db_session.commit()
12251227
return user
12261228

0 commit comments

Comments
 (0)