feat: added lots of work to landing page

This commit is contained in:
Blake Ridgway
2025-11-19 09:03:29 -06:00
parent 57e09ceea9
commit ac1d18f3a3
8 changed files with 1704 additions and 339 deletions

View File

@@ -58,6 +58,14 @@ func (db *DB) InitDB(ctx context.Context) error {
body TEXT NOT NULL,
sent_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)`,
`CREATE TABLE IF NOT EXISTS contact_messages (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL,
subject TEXT NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)`,
}
for _, query := range queries {
@@ -155,6 +163,28 @@ func (db *DB) GetNewsletter(
return &n, nil
}
func (db *DB) AddContactMessage(
ctx context.Context,
name, email, subject, message string,
) error {
query := `
INSERT INTO contact_messages (name, email, subject, message, created_at)
VALUES ($1, $2, $3, $4, $5)
`
_, err := db.pool.Exec(
ctx,
query,
name,
email,
subject,
message,
time.Now(),
)
return err
}
func (db *DB) Close(ctx context.Context) {
db.pool.Close()
}