From 02ae9b81b865f2df49613ad0dd6077965231e03c Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Wed, 10 Jun 2026 09:08:57 +0100 Subject: [PATCH] fix: get the type of settings --- apps/api/src/services/course/invite.ts | 3 +-- packages/db/src/queries/course/course.ts | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/api/src/services/course/invite.ts b/apps/api/src/services/course/invite.ts index 7a8684dd..551e7cf2 100644 --- a/apps/api/src/services/course/invite.ts +++ b/apps/api/src/services/course/invite.ts @@ -631,8 +631,7 @@ export async function enrollInCourse( } const courseMetadata = (courseWithRelations.metadata as { allowNewStudent?: boolean } | null) ?? null; - const isInternalEnrollmentOnly = - (org.settings as { internalEnrollmentOnly?: boolean } | null)?.internalEnrollmentOnly ?? false; + const isInternalEnrollmentOnly = org.settings?.internalEnrollmentOnly ?? false; const orgMemberId = await getOrganizationMemberIdByOrgAndProfile(org.id, user.id); diff --git a/packages/db/src/queries/course/course.ts b/packages/db/src/queries/course/course.ts index 1446fb12..7bc68aa9 100644 --- a/packages/db/src/queries/course/course.ts +++ b/packages/db/src/queries/course/course.ts @@ -305,6 +305,7 @@ export type CourseWithRelations = TCourse & { customDomain: string | null; isCustomDomainVerified: boolean | null; theme: string | null; + settings: (typeof schema.organization.$inferSelect)['settings']; } | null; }; @@ -349,6 +350,7 @@ export async function getCourseWithRelations( customDomain: string | null; isCustomDomainVerified: boolean | null; theme: string | null; + settings: (typeof schema.organization.$inferSelect)['settings']; } | null; }; // Fetch group data (and org via join) if groupId exists @@ -413,7 +415,8 @@ export async function getCourseWithRelations( siteName: groupData[0].organization.siteName ?? null, customDomain: groupData[0].organization.customDomain ?? null, isCustomDomainVerified: groupData[0].organization.isCustomDomainVerified ?? null, - theme: groupData[0].organization.theme ?? null + theme: groupData[0].organization.theme ?? null, + settings: groupData[0].organization.settings ?? null } : null;