diff --git a/db/package.go b/db/package.go index 9fb6678..1e373a3 100644 --- a/db/package.go +++ b/db/package.go @@ -59,7 +59,7 @@ func FetchPackageLatestRevision(id int) (int, error) { func FetchPackage(id int, rev int) (common.Package, error) { var pkg common.Package - err := handle.QueryRow("SELECT id, rev, type, name, dataname, author, description, downloads, favorites, goods, bads, data FROM packages WHERE id = ? AND rev = ?", id, rev).Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.Description, &pkg.Downloads, &pkg.Favorites, &pkg.Goods, &pkg.Bads, &pkg.Data) + err := handle.QueryRow("SELECT id, rev, type, name, dataname, author, description, data FROM packages WHERE id = ? AND rev = ?", id, rev).Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.Description, &pkg.Data) if err != nil { return pkg, err } @@ -99,7 +99,7 @@ func FetchPackage(id int, rev int) (common.Package, error) { func FetchPackageList(category string, author string, search string, offset int, count int, sort string, safemode bool) ([]common.Package, error) { var args []any - q := "SELECT p.id, p.rev, p.type, p.name, p.dataname, p.author, IFNULL(profiles.personaname, p.legacyauthor), IFNULL(profiles.avatarmedium, \"\"), p.description, p.time FROM packages p LEFT JOIN profiles ON p.author = profiles.steamid WHERE p.rev = (SELECT MAX(p2.rev) FROM packages p2 WHERE p2.id = p.id)" + q := "SELECT p.id, p.rev, p.type, p.name, p.dataname, p.author, IFNULL(profiles.personaname, p.legacyauthor), IFNULL(profiles.avatarmedium, \"\"), p.description, p.downloads, p.favorites, p.goods, p.bads, p.time FROM packages p LEFT JOIN profiles ON p.author = profiles.steamid WHERE p.rev = (SELECT MAX(p2.rev) FROM packages p2 WHERE p2.id = p.id)" if category != "" { q += " AND p.type = ?" @@ -140,7 +140,7 @@ func FetchPackageList(category string, author string, search string, offset int, for rows.Next() { var pkg common.Package - err := rows.Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.AuthorName, &pkg.AuthorIcon, &pkg.Description, &pkg.Uploaded) + err := rows.Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.AuthorName, &pkg.AuthorIcon, &pkg.Description, &pkg.Downloads, &pkg.Favorites, &pkg.Goods, &pkg.Bads, &pkg.Uploaded) if err != nil { return list, err }