Migrate IMAP boxes listing from backend to emails-fetcher + edge function#2854
Open
malek10xdev wants to merge 5 commits into
Open
Migrate IMAP boxes listing from backend to emails-fetcher + edge function#2854malek10xdev wants to merge 5 commits into
malek10xdev wants to merge 5 commits into
Conversation
Add a new POST /api/imap/boxes endpoint to the emails-fetcher that retrieves the IMAP folder tree for a given email. The endpoint: - Validates userId and email input - Fetches IMAP credentials from the mining source service - Opens an IMAP connection via ImapConnectionProvider - Uses ImapBoxesFetcher to build the IMAP folder tree - Properly handles connection cleanup in finally block
Migrate the IMAP edge function from raw Deno.serve to Hono framework. Add POST /boxes endpoint that proxies IMAP folder listing requests to the emails-fetcher microservice. Refactor /detect to use Hono routing.
Replace the backend API call (/api/imap/boxes) with a direct Supabase edge function invocation (imap/boxes). Only requires email now, since the edge function resolves the user ID from the auth token.
Remove the old backend IMAP controller, routes, and service for listing IMAP boxes. This functionality has been migrated to: - The supabase/functions/imap edge function (proxies to emails-fetcher) - The micro-services/emails-fetcher microservice (actual IMAP logic)
Coverage Report✅ Passed Commit: 5584ffe Summary
All files
No coverage changes
Generated by Test Coverage Reporter for commit 5584ffe |
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.
Summary
Migrate the IMAP boxes folder listing from the legacy backend API (
/api/imap/boxes) to theemails-fetchermicroservice, proxied through the Supabaseimapedge function. This removes backend dead code and moves IMAP logic closer to the email-fetching service.Changes
POST /api/imap/boxesendpoint toemails-fetcher— validates input, fetches IMAP credentials from mining source service, opens connection viaImapConnectionProvider, and returns the folder tree fromImapBoxesFetcherImapBoxesFetcher+imapTreeHelperstoemails-fetcher— encapsulates IMAP folder tree building logic usingimapflowsupabase/functions/imapto Hono framework; addPOST /boxesendpoint that proxies toemails-fetcherwith user authleadminerstore to callsupabase.functions.invoke('imap/boxes')instead of backend APIbackend/src/controllers/imap.controller.ts,backend/src/routes/imap.routes.ts,backend/src/services/imap/ImapBoxesFetcher.ts, andinitializeImapRoutesfromapp.tsTesting