Store contact form submissions in database#31
Conversation
- 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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Reviewer's GuideImplements 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 submissionssequenceDiagram
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 }
Sequence diagram for Vercel contact function storing submissionssequenceDiagram
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 }
ER diagram for new contact_submissions tableerDiagram
contact_submissions {
varchar id PK
text name
text email
text project_type
text budget
text message
timestamp created_at
}
Class diagram for updated storage layer with contact submissionsclassDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This change implements the storage of contact form submissions in the database for backup.
Key changes:
contact_submissionstable toshared/schema.tsusing Drizzle ORM.IStorageandMemStorageto support inserting contact submissions.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:
Enhancements: