Skip to content
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

Created new db name field #942

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions backend/pkg/api/data_access/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,63 +15,75 @@ func (d *DataAccessService) GetAllClients() ([]types.ClientInfo, error) {
{
Id: 0,
Name: "Geth",
DbName: "geth",
Category: "execution_layer",
},
{
Id: 1,
Name: "Nethermind",
DbName: "nethermind",
Category: "execution_layer",
},
{
Id: 2,
Name: "Besu",
DbName: "besu",
Category: "execution_layer",
},
{
Id: 3,
Name: "Erigon",
DbName: "erigon",
Category: "execution_layer",
},
{
Id: 4,
Name: "Reth",
DbName: "reth",
Category: "execution_layer",
},
// consensus_layer
{
Id: 5,
Name: "Teku",
DbName: "teku",
Category: "consensus_layer",
},
{
Id: 6,
Name: "Prysm",
DbName: "prysm",
Category: "consensus_layer",
},
{
Id: 7,
Name: "Nimbus",
DbName: "nimbus",
Category: "consensus_layer",
},
{
Id: 8,
Name: "Lighthouse",
DbName: "lighthouse",
Category: "consensus_layer",
},
{
Id: 9,
Name: "Lodestar",
DbName: "lodestar",
Category: "consensus_layer",
},
// other
{
Id: 10,
Name: "Rocketpool Smart Node",
DbName: "rocketpool",
Category: "other",
},
{
Id: 11,
Name: "MEV-Boost",
DbName: "mev-boost",
Category: "other",
},
}, nil
Expand Down
12 changes: 12 additions & 0 deletions backend/pkg/api/data_access/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,63 +418,75 @@ func (d *DummyService) GetAllClients() ([]types.ClientInfo, error) {
{
Id: 0,
Name: "Geth",
DbName: "geth",
Category: "execution_layer",
},
{
Id: 1,
Name: "Nethermind",
DbName: "nethermind",
Category: "execution_layer",
},
{
Id: 2,
Name: "Besu",
DbName: "besu",
Category: "execution_layer",
},
{
Id: 3,
Name: "Erigon",
DbName: "erigon",
Category: "execution_layer",
},
{
Id: 4,
Name: "Reth",
DbName: "reth",
Category: "execution_layer",
},
// consensus_layer
{
Id: 5,
Name: "Teku",
DbName: "teku",
Category: "consensus_layer",
},
{
Id: 6,
Name: "Prysm",
DbName: "prysm",
Category: "consensus_layer",
},
{
Id: 7,
Name: "Nimbus",
DbName: "nimbus",
Category: "consensus_layer",
},
{
Id: 8,
Name: "Lighthouse",
DbName: "lighthouse",
Category: "consensus_layer",
},
{
Id: 9,
Name: "Lodestar",
DbName: "lodestar",
Category: "consensus_layer",
},
// other
{
Id: 10,
Name: "Rocketpool Smart Node",
DbName: "rocketpool",
Category: "other",
},
{
Id: 11,
Name: "MEV-Boost",
DbName: "mev-boost",
Category: "other",
},
}, nil
Expand Down
6 changes: 3 additions & 3 deletions backend/pkg/api/data_access/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ func (d *DataAccessService) GetNotificationSettings(ctx context.Context, userId
}
clientSettings := make(map[string]*t.NotificationSettingsClient, len(clients))
for _, client := range clients {
clientSettings[strings.ToLower(client.Name)] = &t.NotificationSettingsClient{
clientSettings[client.DbName] = &t.NotificationSettingsClient{
Id: client.Id,
Name: client.Name,
Category: client.Category,
Expand Down Expand Up @@ -1447,10 +1447,10 @@ func (d *DataAccessService) UpdateNotificationSettingsClients(ctx context.Contex
VALUES ($1, $2, $3, NOW(), $4)
ON CONFLICT (user_id, event_name, event_filter)
DO NOTHING`,
userId, types.EthClientUpdateEventName, strings.ToLower(clientInfo.Name), utils.TimeToEpoch(time.Now()))
userId, types.EthClientUpdateEventName, clientInfo.DbName, utils.TimeToEpoch(time.Now()))
} else {
_, err = d.userWriter.ExecContext(ctx, `DELETE FROM users_subscriptions WHERE user_id = $1 AND event_name = $2 AND event_filter = $3`,
userId, types.EthClientUpdateEventName, strings.ToLower(clientInfo.Name))
userId, types.EthClientUpdateEventName, clientInfo.DbName)
}
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions backend/pkg/api/types/data_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ type NetworkInfo struct {
type ClientInfo struct {
Id uint64
Name string
DbName string
Category string
}

Expand Down
Loading