diff --git a/server/controllers/game.ts b/server/controllers/game.ts index a57463e6c..679941c5e 100644 --- a/server/controllers/game.ts +++ b/server/controllers/game.ts @@ -401,7 +401,7 @@ gameController.get({ path: '/standardGame/:id', userType: UserType.TEACHER }, as } const id = parseInt(req.params.id, 10) || 0; const activity = await AppDataSource.getRepository(Activity).findOne({ where: { id } }); - const activityId = activity.id; + const activityId = activity?.id; if (!activity || (req.user.type === UserType.TEACHER && req.user.villageId !== activity.villageId)) { next(); return; diff --git a/types/activity.type.ts b/types/activity.type.ts index 94985cc76..76b3a8a93 100644 --- a/types/activity.type.ts +++ b/types/activity.type.ts @@ -3,6 +3,7 @@ export interface ActivityContent { id: number; // needed to sort content. type: ActivityContentType; value: string; + game?: unknown; } export type AnyData = Record;