mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-09 23:19:11 +02:00
fixes + tests
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
@@ -17,7 +17,7 @@ const (
|
||||
(
|
||||
select array_agg(group_peers.peer_id)
|
||||
from group_peers
|
||||
where group_peers.group_id = groups.id
|
||||
where group_peers.group_id = groups.id and group_peers.account_id=$1
|
||||
) as peers
|
||||
from groups where account_id=$1
|
||||
`
|
||||
|
||||
@@ -3,6 +3,7 @@ package networkmap_pgsql
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
@@ -13,11 +14,11 @@ import (
|
||||
|
||||
const (
|
||||
GetNetworkRouterQuery = `
|
||||
select public_id, peer, network_id, masquerade, metric, enabled,
|
||||
select public_id, peer, network_id, masquerade, metric, enabled, peer_groups,
|
||||
(
|
||||
select array_agg(group_peers.peer_id)
|
||||
from group_peers
|
||||
where group_peers.group_id in (select json_array_elements_text(peer_groups::json))
|
||||
where group_peers.account_id=$1 and group_peers.group_id in (select json_array_elements_text(peer_groups::json))
|
||||
) as peers_via_groups
|
||||
from network_routers
|
||||
where account_id=$1
|
||||
@@ -79,7 +80,8 @@ type networkrouter struct {
|
||||
PublicID sql.NullString
|
||||
NetworkID sql.NullString `nmap:"skip"`
|
||||
Peer sql.NullString `nmap:"skip"`
|
||||
PeersViaGroups []string `nmap:"map_to:PeerGroups"`
|
||||
PeerGroups json.RawMessage
|
||||
PeersViaGroups []string `nmap:"skip"`
|
||||
Masquerade sql.NullBool
|
||||
Metric sql.NullInt64
|
||||
Enabled sql.NullBool
|
||||
|
||||
Reference in New Issue
Block a user