-
Notifications
You must be signed in to change notification settings - Fork 3
ENG-371 create context for subsequent supabase operations #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughA new utility for fetching and caching Supabase context was introduced and made globally accessible in the Roam extension. Supporting API endpoints for account and person retrieval were enhanced with new GET handlers. The context utility coordinates multiple API calls to retrieve or create platform, space, person, and account records. Changes
Sequence Diagram(s)sequenceDiagram
participant RoamExtension as Roam Extension
participant SupabaseContextUtil as getSupabaseContext
participant API as Next.js API
participant Supabase as Supabase DB
RoamExtension->>SupabaseContextUtil: getSupabaseContext()
SupabaseContextUtil->>API: POST /api/supabase/platform (with Roam URL)
API->>Supabase: Query/Create Platform
API-->>SupabaseContextUtil: platformId
SupabaseContextUtil->>API: POST /api/supabase/space (with platformId)
API->>Supabase: Query/Create Space
API-->>SupabaseContextUtil: spaceId
SupabaseContextUtil->>API: GET /api/supabase/account?platform_id&account_local_id
API->>Supabase: Query Account
API-->>SupabaseContextUtil: userId or null
alt Account not found
SupabaseContextUtil->>API: GET /api/supabase/person?email
API->>Supabase: Query Person
API-->>SupabaseContextUtil: personId or null
SupabaseContextUtil->>API: POST /api/supabase/person (if needed)
API->>Supabase: Create Person
API-->>SupabaseContextUtil: personId
SupabaseContextUtil->>API: POST /api/supabase/account (create)
API->>Supabase: Create Account
API-->>SupabaseContextUtil: userId
end
SupabaseContextUtil-->>RoamExtension: { platformId, spaceId, userId }
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
🧹 Nitpick comments (2)
apps/roam/src/utils/supabaseContext.ts (2)
36-38: Extract URL parsing logic for reusability.The URL parsing logic to extract the space name could be extracted into a utility function.
Consider extracting:
+const extractSpaceNameFromUrl = (url: string): string => { + const urlParts = url.split("/"); + return urlParts[urlParts.length - 1]; +}; const url = getRoamUrl(); - const urlParts = url.split("/"); - const name = urlParts[urlParts.length - 1]; + const name = extractSpaceNameFromUrl(url);
61-61: Track TODO comment for future enhancement.The comment indicates planned support for multiple emails per person.
Would you like me to create an issue to track this enhancement for supporting multiple emails per person?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/roam/src/index.ts(2 hunks)apps/roam/src/utils/supabaseContext.ts(1 hunks)apps/website/app/api/supabase/account/route.ts(3 hunks)apps/website/app/api/supabase/person/route.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/website/app/api/supabase/account/route.ts (3)
apps/website/app/api/supabase/person/route.ts (1)
GET(87-119)apps/website/app/utils/supabase/apiUtils.ts (2)
handleRouteError(54-74)createApiResponse(20-48)apps/website/app/utils/supabase/server.ts (1)
createClient(5-47)
🔇 Additional comments (2)
apps/roam/src/index.ts (1)
25-25: LGTM!The integration of
getSupabaseContextfollows the existing pattern and properly exposes the utility function through the global namespace.Also applies to: 127-127
apps/website/app/api/supabase/account/route.ts (1)
2-2: Verify the uniqueness constraint change is intentional.The import change and uniqueness constraint modification from
["agent_id", "platform_id"]to["account_local_id", "platform_id"]appears to be a significant schema change. Please ensure this aligns with the database schema and won't cause conflicts with existing data.Also applies to: 52-52
dd81b44 to
a63760f
Compare
a63760f to
0e706cf
Compare
0e706cf to
e9dbea8
Compare
mdroidian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff. Two main blockers
- Roam doesn't expose the email to plugins anymore
- What is the use case of adding
getSupabseContextto thewindowobject?
e9dbea8 to
a900054
Compare
a900054 to
ec4124d
Compare
ec4124d to
b03999d
Compare
|
@mdroidian I'm realizing that I still need approval despite having closed al conversations. What action is needed on your side? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only reviewed supabaseContext.ts
I'm assuming this is the only file required of the 23?
b03999d to
fd78491
Compare
fd78491 to
628c2ab
Compare
628c2ab to
051f93b
Compare
051f93b to
f21158c
Compare
Summary by CodeRabbit