-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add endpoints for solana waitlist #2761
base: master
Are you sure you want to change the base?
Conversation
432ddfc
to
b6edd89
Compare
1fcbf2b
to
8a8c88a
Compare
[puLL-Merge] - brave-intl/bat-go@2761 DescriptionThis PR adds support for a Solana waitlist feature to the bat-go wallet service. It includes new database tables, API endpoints for joining and leaving the waitlist, and various supporting code changes. The changes enable users to register their interest in using Solana functionality before it's fully available. ChangesChangeslibs/datastore/postgres.go:
migrations/0070_create_solana_waitlist.down.sql & up.sql:
services/wallet/datastore.go:
services/wallet/handler/handler.go:
services/wallet/service.go:
services/wallet/storage/storage.go:
sequenceDiagram
participant Client
participant API
participant Service
participant Database
%% Join waitlist
Client->>API: POST /v3/wallet/solana/waitlist
API->>Service: SolanaAddToWaitlist()
Service->>Database: Check if already linked
Service->>Database: Insert into solana_waitlist
Database-->>Service: Success/Error
Service-->>API: Response
API-->>Client: 201 Created / Error
%% Leave waitlist
Client->>API: DELETE /v3/wallet/solana/waitlist/{id}
API->>Service: SolanaDeleteFromWaitlist()
Service->>Database: Delete from solana_waitlist
Database-->>Service: Success/Error
Service-->>API: Response
API-->>Client: 200 OK / Error
|
suite.Require().NoError(err, "Failed to get postgres conn") | ||
|
||
for _, table := range tables { | ||
_, err = pg.RawDB().Exec("delete from " + table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[semgrep] String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data.
Source: https://semgrep.dev/r/go.lang.security.audit.database.string-formatted-query.string-formatted-query
Cc @thypon @kdenhartog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test code that has been around for ages, file was renamed hence why its coming up now.
Summary
This PR implements two endpoints so users can add and remove themselves to a Solana waitlist.
Users who are already linked to Solana should not be able to add themselves to the waitlist.
Closes #2762
Type of Change
Tested Environments
Before Requesting Review
Manual Test Plan