Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion services/libs/data-access-layer/src/repositories/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export interface IRepositoryMapping {
}
gitIntegrationId: string
sourceIntegrationId: string
sourcePlatform: string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface type doesn't match nullable SQL LEFT JOIN result

Medium Severity

The sourcePlatform field is typed as string in the IRepositoryMapping interface, but the SQL query uses a LEFT JOIN on the integrations table. When a repository matches via gitIntegrationId but has no matching sourceIntegrationId in the integrations table, i.platform will be NULL. Consuming code relying on sourcePlatform being a non-null string could fail at runtime or behave incorrectly when it receives null.

Additional Locations (1)

Fix in Cursor Fix in Web

}

/**
Expand All @@ -341,9 +342,11 @@ export async function getIntegrationReposMapping(
'name', s.name
) as segment,
r."gitIntegrationId",
r."sourceIntegrationId"
r."sourceIntegrationId",
i.platform as "sourcePlatform"
FROM public.repositories r
JOIN segments s ON s.id = r."segmentId"
LEFT JOIN integrations i ON i.id = r."sourceIntegrationId"
WHERE (r."gitIntegrationId" = $(integrationId) OR r."sourceIntegrationId" = $(integrationId))
AND r."deletedAt" IS NULL
ORDER BY r.url
Expand Down