Skip to content
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
4 changes: 4 additions & 0 deletions internal/ban/ban_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ func (s Service) Create(ctx context.Context, req *v1.CreateRequest) (*v1.CreateR

createdBan, errBan := s.bans.Create(ctx, opts)
if errBan != nil {
if errors.Is(errBan, database.ErrDuplicate) {
return nil, connect.NewError(connect.CodeAlreadyExists, rpc.ErrExists)
}

slog.Error("Failed to create ban", slog.String("error", errBan.Error()))

return nil, connect.NewError(connect.CodeInternal, ErrSaveBan)
Expand Down
2 changes: 1 addition & 1 deletion internal/ban/report_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (r ReportRepository) GetReport(ctx context.Context, reportID int32) (Report
"coalesce(d.demo_id, 0)", "coalesce(s.person_message_id, 0)").
From("report s").
LeftJoin("demo d on s.demo_id = d.demo_id").
Where(sq.And{sq.Eq{"deleted": false}, sq.Eq{"report_id": reportID}}))
Where(sq.And{sq.Eq{"s.deleted": false}, sq.Eq{"s.report_id": reportID}}))

if errRow != nil {
return report, database.Err(errRow)
Expand Down
3 changes: 2 additions & 1 deletion internal/network/network_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"log/slog"
"net/netip"
"strconv"
"sync/atomic"

"connectrpc.com/connect"
Expand Down Expand Up @@ -38,7 +39,7 @@ func NewNetworkService(networks Networks, authMiddleware *rpc.Middleware, option
func (s *Service) QueryConnections(ctx context.Context, req *v1.QueryConnectionsRequest) (*v1.QueryConnectionsResponse, error) {
ipHist, errIPHist := s.networks.QueryConnectionHistory(ctx, ConnectionHistoryQuery{
Filter: rpc.FromRPC(req.GetFilter()),
SourceIDField: httphelper.SourceIDField{},
SourceIDField: httphelper.SourceIDField{SourceID: strconv.FormatInt(req.GetSteamId(), 10)},
CIDR: req.GetCidr(),
CountryCode: req.GetCountryCode(),
CountryName: req.GetCountryName(),
Expand Down
Loading