diff --git a/src/controllers/ProfileFamilyHistoryController.ts b/src/controllers/ProfileFamilyHistoryController.ts index 29456a4e..7a112091 100644 --- a/src/controllers/ProfileFamilyHistoryController.ts +++ b/src/controllers/ProfileFamilyHistoryController.ts @@ -101,10 +101,14 @@ export class ProfileFamilyHistoryController extends Controller { order: { createdAt: "DESC" }, where: { profileId }, }); - return new HttpSuccess({ - ...family[0], - children, - }); + return new HttpSuccess( + family.length > 0 + ? { + ...family[0], + children, + } + : null, + ); } @Get("history/{profileId}")