Skip to content

Store contact form submissions in database#31

Draft
WebCraftPhil wants to merge 1 commit into
mainfrom
feat-store-contact-submissions-in-db-7451428671113987515
Draft

Store contact form submissions in database#31
WebCraftPhil wants to merge 1 commit into
mainfrom
feat-store-contact-submissions-in-db-7451428671113987515

Conversation

@WebCraftPhil

@WebCraftPhil WebCraftPhil commented May 3, 2026

Copy link
Copy Markdown
Owner

This change implements the storage of contact form submissions in the database for backup.

Key changes:

  1. Schema Definition: Added a contact_submissions table to shared/schema.ts using Drizzle ORM.
  2. Storage Interface: Updated IStorage and MemStorage to support inserting contact submissions.
  3. API Integration: Integrated the storage call into both the Express API routes (server/routes.ts) and the Vercel serverless function (api/contact.ts).

This ensures that contact submissions are backed up even if email delivery fails.


PR created automatically by Jules for task 7451428671113987515 started by @WebCraftPhil

Summary by Sourcery

Store contact form submissions when the API receives them.

New Features:

  • Add a contact_submissions table and related schemas and types to persist contact form data.
  • Extend the storage interface and in-memory implementation to support saving contact submissions from the API.

Enhancements:

  • Wire the contact form handlers in both the Express route and Vercel serverless function to persist submissions for backup.

- Defined `contact_submissions` table in `shared/schema.ts`
- Added `insertContactSubmission` method to `IStorage` interface and `MemStorage` implementation
- Updated Express route `/api/contact` to store submissions
- Updated Vercel serverless function `api/contact.ts` to store submissions

Co-authored-by: WebCraftPhil <118385120+WebCraftPhil@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented May 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
philgreene-net Ready Ready Preview, Comment May 3, 2026 2:10am

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48459205-d17a-4fed-955f-c07e030c13d3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-store-contact-submissions-in-db-7451428671113987515

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented May 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements database-backed storage for contact form submissions by adding a new Drizzle schema, extending the storage interface and in-memory implementation, and wiring the storage call into both the Express and Vercel contact handlers so submissions are persisted regardless of email success.

Sequence diagram for Express contact route storing submissions

sequenceDiagram
  actor User
  participant Browser
  participant ExpressServer
  participant Storage
  participant EmailService

  User->>Browser: Fill and submit contact form
  Browser->>ExpressServer: POST /contact { name, email, projectType, budget, message }
  ExpressServer->>Storage: insertContactSubmission(name, email, projectType, budget, message)
  Storage-->>ExpressServer: ContactSubmission
  ExpressServer->>EmailService: sendEmail(details)
  EmailService-->>ExpressServer: email result
  ExpressServer-->>Browser: { ok: true }
Loading

Sequence diagram for Vercel contact function storing submissions

sequenceDiagram
  actor User
  participant Browser
  participant VercelFunction
  participant Storage
  participant EmailService

  User->>Browser: Fill and submit contact form
  Browser->>VercelFunction: POST /api/contact { name, email, projectType, budget, message }
  VercelFunction->>Storage: insertContactSubmission(name, email, projectType, budget, message)
  Storage-->>VercelFunction: ContactSubmission
  VercelFunction->>EmailService: sendEmail(details)
  EmailService-->>VercelFunction: email result
  VercelFunction-->>Browser: { ok: true }
Loading

ER diagram for new contact_submissions table

erDiagram
  contact_submissions {
    varchar id PK
    text name
    text email
    text project_type
    text budget
    text message
    timestamp created_at
  }
Loading

Class diagram for updated storage layer with contact submissions

classDiagram
  class IStorage {
    <<interface>>
    +getUser(id string) Promise_User_
    +getUserByUsername(username string) Promise_User_
    +createUser(user InsertUser) Promise_User_
    +insertContactSubmission(submission InsertContactSubmission) Promise_ContactSubmission_
  }

  class MemStorage {
    -Map_string_User_ users
    -Map_string_User_ usersByUsername
    -Map_string_ContactSubmission_ contactSubmissions
    +MemStorage()
    +getUser(id string) Promise_User_
    +getUserByUsername(username string) Promise_User_
    +createUser(user InsertUser) Promise_User_
    +insertContactSubmission(insertSubmission InsertContactSubmission) Promise_ContactSubmission_
  }

  class InsertContactSubmission {
    +string name
    +string email
    +string projectType
    +string budget
    +string message
  }

  class ContactSubmission {
    +string id
    +string name
    +string email
    +string projectType
    +string budget
    +string message
    +Date createdAt
  }

  IStorage <|.. MemStorage
  InsertContactSubmission --> ContactSubmission
  MemStorage --> ContactSubmission
Loading

File-Level Changes

Change Details Files
Add Drizzle ORM schema and types for contact form submissions
  • Define contactSubmissions table with UUID primary key, required name/email/message, optional projectType/budget, and createdAt timestamp with default now
  • Create insertContactSubmissionSchema omitting id and createdAt for inserts
  • Export InsertContactSubmission and ContactSubmission TypeScript types inferred from the schema
shared/schema.ts
Extend storage abstraction and in-memory storage to support persisting contact submissions
  • Extend IStorage interface with insertContactSubmission method returning a ContactSubmission
  • Add in-memory Map for contact submissions to MemStorage
  • Implement insertContactSubmission in MemStorage using randomUUID, normalizing optional projectType and budget to null and setting createdAt
server/storage.ts
Persist contact form submissions in both Vercel and Express contact handlers
  • Inject storage into the Vercel contact API handler and call insertContactSubmission after sending email
  • Replace TODO in Express /contact route with awaited storage.insertContactSubmission call after email send
api/contact.ts
server/routes.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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