diff --git a/internal/db/models.go b/internal/db/models.go index f09bcec0..d439e8ec 100644 --- a/internal/db/models.go +++ b/internal/db/models.go @@ -97,25 +97,6 @@ type ImageType struct { Extensions []string `json:"extensions"` } -type Newsletter struct { - Subject string `json:"subject"` - ArchiveURL string `json:"archive_url"` - PublishedAt time.Time `json:"published_at"` - Type string `json:"type"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` - ID int64 `json:"id"` - Description string `json:"description"` - Blurb string `json:"blurb"` - SpotlightPAPath pgtype.Text `json:"spotlightpa_path"` -} - -type NewsletterType struct { - Shortname string `json:"shortname"` - Name string `json:"name"` - Description string `json:"description"` -} - type Option struct { ID int64 `json:"id"` Key string `json:"key"` diff --git a/internal/db/page.sql.go b/internal/db/page.sql.go index e5697191..7829bb88 100644 --- a/internal/db/page.sql.go +++ b/internal/db/page.sql.go @@ -30,24 +30,6 @@ func (q *Queries) CreatePage(ctx context.Context, arg CreatePageParams) error { return err } -const getArchiveURLForPageID = `-- name: GetArchiveURLForPageID :one -SELECT - coalesce(archive_url, '') -FROM - page - LEFT JOIN newsletter ON page.source_id = newsletter.id::text - AND page.source_type = 'mailchimp' -WHERE - page.id = $1 -` - -func (q *Queries) GetArchiveURLForPageID(ctx context.Context, id int64) (string, error) { - row := q.db.QueryRow(ctx, getArchiveURLForPageID, id) - var archive_url string - err := row.Scan(&archive_url) - return archive_url, err -} - const getPageByFilePath = `-- name: GetPageByFilePath :one SELECT id, file_path, frontmatter, body, schedule_for, last_published, created_at, updated_at, url_path, source_type, source_id, publication_date diff --git a/internal/mailchimp/import.go b/internal/mailchimp/import.go deleted file mode 100644 index 72abc45b..00000000 --- a/internal/mailchimp/import.go +++ /dev/null @@ -1,62 +0,0 @@ -package mailchimp - -import ( - "context" - "fmt" - "net/http" - - "github.com/carlmjohnson/errorx" - "github.com/carlmjohnson/requests" - "github.com/carlmjohnson/requests/reqhtml" - "github.com/spotlightpa/almanack/internal/xhtml" - "golang.org/x/net/html" - "golang.org/x/net/html/atom" -) - -func ImportPage(ctx context.Context, cl *http.Client, page string) (body string, err error) { - defer errorx.Trace(&err) - - var node html.Node - err = requests. - URL(page). - Client(cl). - Handle(reqhtml.To(&node)). - Fetch(ctx) - if err != nil { - return "", err - } - - return PageContent(&node) -} - -func PageContent(doc *html.Node) (body string, err error) { - // Move