diff --git a/repositories/userRepository.go b/repositories/userRepository.go index bbe84ed..764bcee 100644 --- a/repositories/userRepository.go +++ b/repositories/userRepository.go @@ -246,6 +246,15 @@ func (r *userRepository) GetTenantUserById(userid int) models.TenantUserInfo { a.firstname,a.lastname,concat(a.firstname,' ',a.lastname) as fullname, a.userfcmtoken,a.pin,a.deviceid,a.devicetype,a.tenantid,a.locationid,a.applocationid, a.issuperadmin, + -- The PERSON's own address, kept distinct from the shop's below. + -- + -- Omitted when this query only served the web logins, and it only + -- mattered once it began serving /mob/users/tenant/login: that route + -- used to answer from UserInfo, where these five were populated, so + -- leaving them out turned five live fields into empty strings. The + -- tenant side is aliased (tenantaddress, tenantcity, ...) precisely + -- so both a person and their shop can be returned together. + a.address,a.suburb,a.city,a.state,a.postcode, b.partnerid,b.moduleid,b.categoryid as categoryid,b.subcategoryid as subcategoryid, b.applocationid,b.tenantname,b.address as tenantaddress,b.state as tenantstate,b.city as tenantcity, b.postcode as tenantpostcode,b.latitude as tenantlat,b.longitude as tenantlong,c.locationname AS applocation, @@ -261,7 +270,17 @@ func (r *userRepository) GetTenantUserById(userid int) models.TenantUserInfo { ` r.db.Raw(query, userid).Scan(&info) - print(query) + + // Lower-cased, as the other three reads of this table already do. + // + // `app_users.status` is stored inconsistently — "Active" here, "active" + // elsewhere — and every other path through this repository normalises it on + // the way out. This one did not, which only surfaced when it began serving + // /mob/users/tenant/login: that route previously answered "active" and now + // answered "Active", so any client comparing the string exactly would have + // read a live shop as disabled. + info.Status = strings.ToLower(info.Status) + return info }