feat: convert InsightsBookingService to use Prisma.sql raw queries#7
Open
zaibkhan wants to merge 1 commit into
Open
feat: convert InsightsBookingService to use Prisma.sql raw queries#7zaibkhan wants to merge 1 commit into
zaibkhan wants to merge 1 commit into
Conversation
…22345) * fix: use raw query at InsightsBookingService * feat: convert InsightsBookingService to use Prisma.sql raw queries - Convert auth conditions from Prisma object notation to Prisma.sql - Convert filter conditions from Prisma object notation to Prisma.sql - Update return types from Prisma.BookingTimeStatusDenormalizedWhereInput to Prisma.Sql - Fix type error in isOrgOwnerOrAdmin method - Follow same pattern as InsightsRoutingService conversion Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * feat: convert InsightsBookingService to use Prisma.sql raw queries - Convert auth conditions from Prisma object notation to Prisma.sql - Convert filter conditions from Prisma object notation to Prisma.sql - Update return types from Prisma.BookingTimeStatusDenormalizedWhereInput to Prisma.Sql - Fix type error in isOrgOwnerOrAdmin method - Follow same pattern as InsightsRoutingService conversion Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: update InsightsBookingService integration tests for Prisma.sql format - Replace Prisma object notation expectations with Prisma.sql template literals - Add NOTHING_CONDITION constant for consistency with InsightsRoutingService - Update all test cases to use direct Prisma.sql comparisons - Use $queryRaw for actual database integration testing - Follow same testing patterns as InsightsRoutingService Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: exclude intentionally skipped jobs from required CI check failure - Remove 'skipped' from failure condition in pr.yml and all-checks.yml - Allow E2E jobs to be skipped without failing the required check - Only actual failures and cancelled jobs will cause required check to fail Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix tests * Revert "fix: exclude intentionally skipped jobs from required CI check failure" This reverts commit 6ff44fc9a8f14ad657f7bba7c2e454e192b66c8f. * clean up tests * address feedback --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codoki PR ReviewSummary: Fix org member fetch gating, prevent missing user bookings Issues (Critical & High only)
Showing top 1 issues. Critical: 0, High: 1. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 3/5 — Needs work before merge (1 high · status: Requires changes) Sequence DiagramsequenceDiagram
participant Caller
participant InsightsBookingService
participant TeamRepository
participant MembershipRepository
Caller->>InsightsBookingService: getBaseConditions()
InsightsBookingService->>InsightsBookingService: getAuthorizationConditions()
alt options invalid or not owner/admin
InsightsBookingService-->>Caller: NOTHING_CONDITION
else user scope
InsightsBookingService-->>Caller: ("userId" = ? AND "teamId" IS NULL)
else org scope
InsightsBookingService->>TeamRepository: findAllByParentId(orgId)
TeamRepository-->>InsightsBookingService: teamsFromOrg
InsightsBookingService->>MembershipRepository: findAllByTeamIds(teamIds)
MembershipRepository-->>InsightsBookingService: userIdsFromOrg
InsightsBookingService-->>Caller: team OR user conditions
else team scope
InsightsBookingService->>TeamRepository: findByIdAndParentId(teamId, orgId)
TeamRepository-->>InsightsBookingService: childTeamOfOrg
InsightsBookingService->>MembershipRepository: findAllByTeamIds([teamId])
MembershipRepository-->>InsightsBookingService: userIdsFromTeam
InsightsBookingService-->>Caller: team OR user conditions
end
Caller->>InsightsBookingService: getFilterConditions()
InsightsBookingService-->>Caller: filterSql|null
Caller-->>Caller: Combine with AND when both present
React with 👍 or 👎 if you found this review useful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.