Skip to content
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

refactor(intake-email): mutualized intake-emails creation in drivers #137

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

CorentinTh
Copy link
Member

Preparation for OwlRelay integration

@CorentinTh CorentinTh requested a review from Copilot February 26, 2025 19:45
@CorentinTh CorentinTh self-assigned this Feb 26, 2025
Copy link

cloudflare-workers-and-pages bot commented Feb 26, 2025

Deploying papra-client with  Cloudflare Pages  Cloudflare Pages

Latest commit: d4a9689
Status: ✅  Deploy successful!
Preview URL: https://9c229fab.papra.pages.dev
Branch Preview URL: https://intake-email-drivers.papra.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Feb 26, 2025

Deploying papra-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: d4a9689
Status: ✅  Deploy successful!
Preview URL: https://c2a7af3e.papra-demo.pages.dev
Branch Preview URL: https://intake-email-drivers.papra-demo.pages.dev

View logs

Choose a reason for hiding this comment

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

PR Overview

This PR refactors the intake email creation process to support a mutualized driver-based approach and prepares the codebase for OwlRelay integration. Key changes include:

  • Introducing a new "random-username" intake email driver with its configuration and factory.
  • Updating the intake email services, repository, and use cases to use the driver's generated email address rather than relying on username extraction.
  • Adjusting tests, types, routes, and client components to support the new email address generation approach.

Reviewed Changes

File Description
apps/papra-server/src/modules/intake-emails/drivers/random-username/random-username.intake-email-driver.ts Adds the new driver that generates an email address using a random human-readable ID.
apps/papra-server/src/modules/intake-emails/intake-emails.services.ts Creates intake email services using the driver’s generateEmailAddress function.
apps/papra-server/src/modules/intake-emails/drivers/intake-emails.drivers.ts Registers the new random username driver in the drivers mapping.
apps/papra-server/src/modules/intake-emails/drivers/random-username/random-username.intake-email-driver.config.ts Provides configuration (domain) specific to the new driver.
apps/papra-server/src/modules/intake-emails/intake-emails.models.test.ts Adds tests for the buildEmailAddress and parseEmailAddress utilities.
apps/papra-server/src/modules/intake-emails/drivers/intake-emails.drivers.models.ts Updates driver models to integrate with the new intake email driver.
apps/papra-server/src/modules/intake-emails/intake-emails.models.ts Moves email address utilities to a common module for reuse.
apps/papra-server/src/modules/intake-emails/intake-emails.repository.ts Updates repository functions to handle the new emailAddress field and retrieval by email.
apps/papra-server/src/modules/intake-emails/intake-emails.config.ts Enhances configuration to allow driver selection and passes specific driver config.
apps/papra-client/src/modules/intake-emails/pages/intake-emails.page.tsx Updates client side display to use the new emailAddress field.
apps/papra-server/src/modules/intake-emails/intake-emails.usecases.ts Refactors use cases to remove the username extraction logic and rely on the generated email address.
apps/papra-client/src/modules/intake-emails/intake-emails.types.ts Updates the IntakeEmail type to include the emailAddress property.
apps/papra-server/src/modules/intake-emails/intake-emails.routes.ts Adjusts API routes to use the new driver-based services for intake email creation.
apps/papra-client/src/modules/intake-emails/intake-emails.models.ts Removes the obsolete formatIntakeEmail function in favor of using the emailAddress directly.

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Copy link

cloudflare-workers-and-pages bot commented Feb 26, 2025

Deploying papra-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d4a9689
Status: ✅  Deploy successful!
Preview URL: https://430c0cb6.papra-2op.pages.dev
Branch Preview URL: https://intake-email-drivers.papra-2op.pages.dev

View logs

@CorentinTh CorentinTh merged commit 416b9d5 into main Feb 26, 2025
6 checks passed
@CorentinTh CorentinTh deleted the intake-email-drivers branch February 26, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant