Skip to content

Commit 2d4ea4a

Browse files
committed
web: fix bundle list scan error on joined columns
Scope the column expression to bundle.* so that columns from joined relations (e.g. auth_user.username) are not included in the main scan target. Without this, bun fails to map the username column to the Bundle struct. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent f318b19 commit 2d4ea4a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎pkg/web/bundles.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (h *webHandler) BundleList(w http.ResponseWriter, r *http.Request) {
3333

3434
var bundles []db.Bundle
3535
q.DB.NewSelect().Model(&bundles).
36-
ColumnExpr("*, (SELECT count(*) FROM bundle_patch WHERE bundle_id = bundle.id) AS patch_count").
36+
ColumnExpr("bundle.*, (SELECT count(*) FROM bundle_patch WHERE bundle_id = bundle.id) AS patch_count").
3737
Relation("Owner").Relation("Project").
3838
Where("owner_id = ?", user.ID).
3939
OrderExpr("name ASC").
@@ -55,7 +55,7 @@ func (h *webHandler) ProjectBundleList(w http.ResponseWriter, r *http.Request) {
5555
pc := h.projectPageCtx(r, project)
5656

5757
sq := q.DB.NewSelect().Model((*db.Bundle)(nil)).
58-
ColumnExpr("*, (SELECT count(*) FROM bundle_patch WHERE bundle_id = bundle.id) AS patch_count").
58+
ColumnExpr("bundle.*, (SELECT count(*) FROM bundle_patch WHERE bundle_id = bundle.id) AS patch_count").
5959
Relation("Owner").Relation("Project").
6060
Where("project_id = ?", project.ID).
6161
OrderExpr("bundle.name ASC")

0 commit comments

Comments
 (0)