Skip to content

Commit 1dded05

Browse files
Fix demo query
1 parent 7b68e70 commit 1dded05

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

internal/demo/demo_respository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (r *demoRepository) GetDemos(ctx context.Context, opts domain.DemoFilter) (
124124
}
125125

126126
if sid, ok := opts.SourceSteamID(); ok {
127-
constraints = append(constraints, sq.Expr("d.stats ?? ?", sid))
127+
constraints = append(constraints, sq.Expr("d.stats ?? ?", sid.String()))
128128
}
129129

130130
if len(opts.ServerIds) > 0 && opts.ServerIds[0] != 0 {

internal/demo/demo_usecase.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/leighmacdonald/gbans/internal/domain"
1515
"github.com/leighmacdonald/gbans/pkg/demoparser"
1616
"github.com/leighmacdonald/gbans/pkg/log"
17-
"github.com/leighmacdonald/steamid/v4/steamid"
1817
)
1918

2019
type demoUsecase struct {
@@ -162,10 +161,10 @@ func (d demoUsecase) Create(ctx context.Context, name string, content io.Reader,
162161
return nil, errParse
163162
}
164163

165-
intStats := map[steamid.SteamID]gin.H{}
164+
intStats := map[string]gin.H{}
166165

167166
for _, steamID := range demoInfo.SteamIDs() {
168-
intStats[steamID] = gin.H{}
167+
intStats[steamID.String()] = gin.H{}
169168
}
170169

171170
fileContents, errReadContent := io.ReadAll(content)

internal/domain/demo.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/gabriel-vasile/mimetype"
1010
"github.com/gin-gonic/gin"
1111
"github.com/gofrs/uuid/v5"
12-
"github.com/leighmacdonald/steamid/v4/steamid"
1312
)
1413

1514
type DemoUsecase interface {
@@ -43,18 +42,18 @@ type DemoMetaData struct {
4342
}
4443

4544
type DemoFile struct {
46-
DemoID int64 `json:"demo_id"`
47-
ServerID int `json:"server_id"`
48-
ServerNameShort string `json:"server_name_short"`
49-
ServerNameLong string `json:"server_name_long"`
50-
Title string `json:"title"`
51-
CreatedOn time.Time `json:"created_on"`
52-
Downloads int64 `json:"downloads"`
53-
Size int64 `json:"size"`
54-
MapName string `json:"map_name"`
55-
Archive bool `json:"archive"` // When true, will not get auto deleted when flushing old demos
56-
Stats map[steamid.SteamID]gin.H `json:"stats"`
57-
AssetID uuid.UUID `json:"asset_id"`
45+
DemoID int64 `json:"demo_id"`
46+
ServerID int `json:"server_id"`
47+
ServerNameShort string `json:"server_name_short"`
48+
ServerNameLong string `json:"server_name_long"`
49+
Title string `json:"title"`
50+
CreatedOn time.Time `json:"created_on"`
51+
Downloads int64 `json:"downloads"`
52+
Size int64 `json:"size"`
53+
MapName string `json:"map_name"`
54+
Archive bool `json:"archive"` // When true, will not get auto deleted when flushing old demos
55+
Stats map[string]gin.H `json:"stats"`
56+
AssetID uuid.UUID `json:"asset_id"`
5857
}
5958

6059
type DemoInfo struct {

0 commit comments

Comments
 (0)