Skip to content

Adds the sqlc query layer for email campaigns#350

Merged
hieunguyent12 merged 9 commits into
devfrom
wchi/email_campaigns
May 15, 2026
Merged

Adds the sqlc query layer for email campaigns#350
hieunguyent12 merged 9 commits into
devfrom
wchi/email_campaigns

Conversation

@williamchiii

@williamchiii williamchiii commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds the sqlc query layer for email campaigns.

This includes queries to create, fetch, list, update, and update the status of email campaigns. The generated sqlc code has also been updated so future repository/service work can call the new campaign database methods.

This also updates the generated sqlc files from sqlc v1.31.1 to sqlc v1.30.0, matching the version used by the GitHub Actions sqlc workflow.

This builds on the email campaign schema and does not add API routes or sending logic yet.

Type of Change

  • New feature (non-breaking change)

Checklist

  • My code follows the project's style guidelines
  • I have commented on complex parts of the code
  • I have updated documentation if necessary
  • I have updated or added tests to cover my changes
  • I have updated the OpenAPI YAML or other API schema files if applicable

Additional Notes

No API behavior changes in this PR. This is database/query layer only.
Added the following SQL queries:

CreateEmailCampaign
GetEmailCampaignByID
ListEmailCampaigns
UpdateEmailCampaign
UpdateEmailCampaignStatus

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the sqlc query layer for email_campaigns so the API's database package can create, fetch, list, and update campaign records before repository/service wiring is added. It also regenerates the sqlc output to align generated headers with the repository's pinned sqlc version.

Changes:

  • Added new email_campaigns.sql queries for create/get/list/update/status-update operations.
  • Added generated sqlc bindings and model support for the new email_campaigns table.
  • Regenerated existing sqlc files so their version headers match sqlc v1.30.0.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/api/internal/database/sqlc/workshops.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/users.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/teams.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/team_members.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/team_join_requests.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/team_invitations.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/stats.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/sessions.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/redeemables.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/models.go Regenerated header version; includes existing email campaign model/types.
apps/api/internal/database/sqlc/interest_submissions.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/hackathons.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/email_campaigns.sql.go New generated Go bindings for email campaign queries.
apps/api/internal/database/sqlc/db.go Regenerated header version only.
apps/api/internal/database/sqlc/bat_runs.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/applications.sql.go Regenerated header version only.
apps/api/internal/database/sqlc/accounts.sql.go Regenerated header version only.
apps/api/internal/database/queries/email_campaigns.sql New source sqlc query definitions for email campaign CRUD/status operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to +72
scheduled_at =
CASE WHEN @scheduled_at_do_update::boolean
THEN @scheduled_at::timestamptz
Comment on lines +87 to +89
scheduled_at =
CASE WHEN @scheduled_at_do_update::boolean
THEN @scheduled_at::timestamptz
Comment thread apps/api/internal/database/queries/email_campaigns.sql Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@williamchiii

Copy link
Copy Markdown
Collaborator Author

@copilot apply changes based on the comments in this thread

…eries

Agent-Logs-Url: https://github.com/swamphacks/core/sessions/1e2e08e9-0737-47dd-8a01-bddead1ad570

Co-authored-by: williamchiii <188648862+williamchiii@users.noreply.github.com>

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Applied in commit 7552d39. Both UpdateEmailCampaign and UpdateEmailCampaignStatus now use sqlc.narg(scheduled_at) so callers can pass nil to clear an existing schedule. Also updated sent_at in UpdateEmailCampaignStatus to use sqlc.narg(sent_at) for the same reason — it's nullable in the schema. The generated Go structs now have *time.Time for ScheduledAt in both param types and SentAt in UpdateEmailCampaignStatusParams.

@williamchiii williamchiii changed the title Wchi/email campaigns Adds the sqlc query layer for email campaigns May 3, 2026
@hieunguyent12

Copy link
Copy Markdown
Member

I had no idea this was possible lol

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.

4 participants