-
Notifications
You must be signed in to change notification settings - Fork 5
Sweetmantech/myc 3460 api apiartistspro lib for getting all account id from privy #173
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
Sweetmantech/myc 3460 api apiartistspro lib for getting all account id from privy #173
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds enterprise-account aggregation and wiring: new Changes
Sequence Diagram(s)sequenceDiagram
participant Handler as getArtistsProHandler
participant Aggregator as getAllEnterpriseAccounts
participant Query as getAccountEmails
participant DB as Supabase
Handler->>Aggregator: request enterprise emails
activate Aggregator
Aggregator->>Aggregator: for each ENTERPRISE_DOMAINS
Aggregator->>Query: getAccountEmails({queryEmail: "@domain"})
activate Query
Query->>DB: supabase select with ilike / eq
DB-->>Query: matched account_emails[]
Query-->>Aggregator: AccountEmail[]
deactivate Query
Aggregator-->>Handler: flattened AccountEmail[]
deactivate Aggregator
Handler-->>Handler: try/catch -> respond {status, artists, message?}
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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. 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/enterprise/getAllEnterpriseAccounts.ts (1)
11-21: Consider adding resilience for partial query failures.Currently, if any single domain query fails, the entire operation fails. Depending on requirements, you may want to handle partial failures gracefully and return successful results while logging failures.
If partial results are acceptable, consider using
Promise.allSettled:export const getAllEnterpriseAccounts = async (): Promise<AccountEmail[]> => { const allEnterpriseEmails: AccountEmail[] = []; // Query for each enterprise domain in parallel const emailPromises = Array.from(ENTERPRISE_DOMAINS).map(domain => getAccountEmails({ queryEmail: `@${domain}` }) ); const results = await Promise.allSettled(emailPromises); results.forEach((result, index) => { if (result.status === 'fulfilled') { allEnterpriseEmails.push(...result.value); } else { const domain = Array.from(ENTERPRISE_DOMAINS)[index]; console.error(`Failed to fetch emails for domain ${domain}:`, result.reason); } }); return allEnterpriseEmails; };This approach ensures partial data is still returned even if some domains fail to query.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
controllers/ArtistsProController/getArtistsProHandler.ts(1 hunks)controllers/SubscriptionsController.ts(2 hunks)lib/enterprise/getAllEnterpriseAccounts.ts(1 hunks)lib/enterprise/isEnterprise.ts(1 hunks)lib/supabase/account_emails/getAccountEmails.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
lib/enterprise/getAllEnterpriseAccounts.ts (3)
types/database.types.ts (1)
Tables(3609-3636)lib/consts.ts (1)
ENTERPRISE_DOMAINS(24-31)lib/supabase/account_emails/getAccountEmails.ts (1)
getAccountEmails(14-36)
controllers/ArtistsProController/getArtistsProHandler.ts (1)
lib/enterprise/getAllEnterpriseAccounts.ts (1)
getAllEnterpriseAccounts(11-21)
controllers/SubscriptionsController.ts (1)
lib/supabase/account_emails/getAccountEmails.ts (1)
getAccountEmails(14-36)
🔇 Additional comments (6)
lib/enterprise/isEnterprise.ts (1)
1-2: LGTM! Import path normalization.The import paths have been adjusted to use up-one-directory references, improving consistency across the enterprise modules. No functional changes.
controllers/SubscriptionsController.ts (2)
3-3: LGTM! Import path updated to use alias.The import path has been updated to use the
@/alias, aligning with the project's path aliasing strategy.
28-28: LGTM! Function call updated to match new signature.The call to
getAccountEmailshas been correctly updated to pass an object withaccount_idproperty, matching the refactored function signature.lib/supabase/account_emails/getAccountEmails.ts (2)
6-9: LGTM! Well-designed parameter type for flexible filtering.The new
GetAccountEmailsParamstype enables flexible filtering with optionalaccount_idandqueryEmailparameters, making the function more versatile.
14-27: LGTM! Clean dynamic query construction.The function correctly builds queries dynamically based on provided parameters. The conditional filter application using
eqfor exact match andilikefor pattern matching is appropriate.controllers/ArtistsProController/getArtistsProHandler.ts (1)
12-27: LGTM! Excellent transition from mock to real data with proper error handling.The implementation successfully replaces static mock data with dynamic enterprise account fetching. The error handling is comprehensive, including logging and graceful error responses with appropriate status codes.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary by CodeRabbit
New Features
Bug Fixes