Add podcast email field for RSS itunes:owner tag
Build and Deploy / build-and-deploy (push) Successful in 56s
Build and Deploy / build-and-deploy (push) Successful in 56s
Enables users to set a podcast contact email from the dashboard settings. This email is included in the RSS feed as itunes:owner/itunes:email, which podcast directories like Spotify and Apple Podcasts require for indexing and verification.
This commit is contained in:
+11
-9
@@ -14,6 +14,7 @@ type User struct {
|
||||
PodcastSlug string
|
||||
PodcastImage string
|
||||
PodcastAuthor string
|
||||
PodcastEmail string
|
||||
CreatedAt string
|
||||
}
|
||||
|
||||
@@ -56,6 +57,7 @@ func migrate(db *sql.DB) error {
|
||||
podcast_slug TEXT NOT NULL DEFAULT '',
|
||||
podcast_image TEXT NOT NULL DEFAULT '',
|
||||
podcast_author TEXT NOT NULL DEFAULT '',
|
||||
podcast_email TEXT NOT NULL DEFAULT '',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
@@ -96,8 +98,8 @@ func (s *Store) CreateUser(email, passwordHash string) (int64, error) {
|
||||
|
||||
func (s *Store) UserByEmail(email string) (*User, error) {
|
||||
u := &User{}
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, created_at FROM users WHERE email = ?", email).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.CreatedAt)
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, podcast_email, created_at FROM users WHERE email = ?", email).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.PodcastEmail, &u.CreatedAt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -106,8 +108,8 @@ func (s *Store) UserByEmail(email string) (*User, error) {
|
||||
|
||||
func (s *Store) GetUser(id int64) (*User, error) {
|
||||
u := &User{}
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, created_at FROM users WHERE id = ?", id).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.CreatedAt)
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, podcast_email, created_at FROM users WHERE id = ?", id).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.PodcastEmail, &u.CreatedAt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -116,8 +118,8 @@ func (s *Store) GetUser(id int64) (*User, error) {
|
||||
|
||||
func (s *Store) UserBySlug(slug string) (*User, error) {
|
||||
u := &User{}
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, created_at FROM users WHERE podcast_slug = ?", slug).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.CreatedAt)
|
||||
err := s.db.QueryRow("SELECT id, email, password_hash, podcast_title, podcast_slug, podcast_image, podcast_author, podcast_email, created_at FROM users WHERE podcast_slug = ?", slug).
|
||||
Scan(&u.ID, &u.Email, &u.PasswordHash, &u.PodcastTitle, &u.PodcastSlug, &u.PodcastImage, &u.PodcastAuthor, &u.PodcastEmail, &u.CreatedAt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -136,9 +138,9 @@ func (s *Store) SlugTaken(slug string, excludeUserID int64) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (s *Store) UpdateUserPodcast(id int64, title, slug, image, author string) error {
|
||||
_, err := s.db.Exec("UPDATE users SET podcast_title=?, podcast_slug=?, podcast_image=?, podcast_author=? WHERE id=?",
|
||||
title, slug, image, author, id)
|
||||
func (s *Store) UpdateUserPodcast(id int64, title, slug, image, author, email string) error {
|
||||
_, err := s.db.Exec("UPDATE users SET podcast_title=?, podcast_slug=?, podcast_image=?, podcast_author=?, podcast_email=? WHERE id=?",
|
||||
title, slug, image, author, email, id)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user