Open
Conversation
This commit introduces the backend implementation for the sponsors public API, following the same patterns as the existing schedule public API. The changes include: - A new database migration to create the `sponsors` table. - A `SponsorsStore` in the store layer with methods for listing, creating, updating, deleting, and retrieving sponsors by ID. - Wiring the `SponsorsStore` into `internal/store/storage.go`. - Adding a `GeneratePublicURL` method to the GCS client interface and implementation. - Adding a separate image upload URL generator to the GCS client.
Adds `GeneratePublicURL` to the GCS client for generating permanent public URLs (e.g. for logos) and `GenerateImageUploadURL` to support image uploads, as the existing upload method is restricted to PDFs. Updates the Client interface and MockClient to include these new methods.
Implements a full CRUD interface for managing sponsors, available to superadmins under `/v1/superadmin/sponsors`. This includes creating, listing, updating, and deleting sponsors, along with generating signed URLs for direct-to-GCS logo uploads. A new public, API-key-protected endpoint is also added at `/v1/public/sponsors` to list all sponsors with their public logo URLs. This is supported by: - A new `Sponsors` store for database interactions. - GCS client enhancements for generating public URLs and image-specific upload URLs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(sponsors): implement sponsors public API with GCS logo support
Summary
This PR implements the backend for the Sponsors Public API, following the same architecture and patterns used by the existing schedule API.
It introduces full CRUD management for sponsors, superadmin routes for sponsor management, and a public endpoint used by the marketing site to retrieve sponsors with permanent logo URLs.
Additionally, the GCS client is extended to support generating permanent public URLs and signed image upload URLs for sponsor logos.
Changes
Database
Added migration
000023_create_sponsors.up/down.sqlCreates a
sponsorstable with fields for:idnametierlogo_pathwebsite_urldescriptiondisplay_ordercreated_atupdated_atStore Layer
Added
internal/store/sponsors.goImplemented
SponsorsStorewith:ListCreateUpdateDeleteGetByIDWired the store into
internal/store/storage.goGCS Client
Extended the GCS client interface and implementation with:
GeneratePublicURL(objectPath string) stringReturns permanent public URLs for sponsor logos
Format:
GenerateImageUploadURL(ctx, objectPath)Updated:
ClientinterfaceMockClientfor testingAPI Handlers
Added sponsor API handlers in:
Superadmin Routes
Mounted under:
Endpoints:
POST /→ create sponsorGET /→ list sponsorsPUT /{id}→ update sponsor metadataDELETE /{id}→ delete sponsor (best-effort logo deletion from GCS)POST /{id}/logo-upload-url→ generate signed upload URL for sponsor logoPublic Sponsors Endpoint
Added API-key-protected route:
Returns:
logo_urlgenerated viaGeneratePublicURLThis endpoint is consumed by the marketing Next.js site.
Testing
Added and updated tests for:
Updated mocks to support new GCS client methods.
Notes
sponsors/prefix in the GCS bucket will need to be made publicly readable.Per project instructions, GCS bucket configuration is not modified in this PR.