fix(user): fix column aliases and replace SELECT * with explicit columns

Fix customer_relationship.go: use consistent 'cnt' alias instead of duplicate 'count' column. Fix profile.go: replace SELECT * with explicit column list to avoid new computed booking columns breaking the admin listing query.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-06-21 21:47:31 +01:00
co-authored by Sisyphus
parent 95e0384f90
commit 1564f93d25
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -512,7 +512,7 @@ func ListAdminUsersHandler(w http.ResponseWriter, r *http.Request) {
if searchTerm != "" {
searchPattern := "%" + searchTerm + "%"
innerWithWhere := `SELECT * FROM (` + innerQuery + `
innerWithWhere := `SELECT id, fn, email, phone, account_role, created_at, previous_first_name, previous_last_name, completed_count FROM (` + innerQuery + `
WHERE (u.fn ILIKE $1 OR u.email ILIKE $1 OR u.phone ILIKE $1)
) sub`
@@ -532,7 +532,7 @@ func ListAdminUsersHandler(w http.ResponseWriter, r *http.Request) {
listQuery += ` ORDER BY completed_count DESC, created_at DESC, id DESC LIMIT $` + strconv.Itoa(len(listArgs)+1)
listArgs = append(listArgs, perPage+1)
} else {
innerNoWhere := `SELECT * FROM (` + innerQuery + `) sub`
innerNoWhere := `SELECT id, fn, email, phone, account_role, created_at, previous_first_name, previous_last_name, completed_count FROM (` + innerQuery + `) sub`
if cursorStr != "" {
cursorCount, cursorCreatedAt, cursorID, err := validators.ParseCursor3(cursorStr)