bugs fixed

This commit is contained in:
2026-08-28 18:19:52 +05:30
parent 40500f936a
commit 7c5be9b5cf
4 changed files with 96 additions and 39 deletions

View File

@@ -281,6 +281,15 @@ func (r *userRepository) CreateUser(user models.User) (int, error) {
return user.Userid, nil
}
// GetUserById reads one person back.
//
// The app_location join is LEFT, not INNER, and that is the whole fix. A user is
// not required to belong to an app location, and an INNER JOIN did not "filter"
// those users — it made them unreadable. CreateUser looks the new row up through
// here to return it, so creating a store user with no applocationid answered 201
// with userid 0 and every field blank. The user existed and every listing showed
// it; only the response meant to confirm the creation came back empty, which
// reads as a failure that silently succeeded.
func (r *userRepository) GetUserById(uid int) (models.UserInfo, error) {
var user models.UserInfo
@@ -289,7 +298,7 @@ func (r *userRepository) GetUserById(uid int) (models.UserInfo, error) {
a.userfcmtoken,a.pin,a.deviceid,a.devicetype,a.tenantid,a.shiftid,
a.applocationid,b.locationname as applocation,b.latitude as applatitude,b.longitude as applongitude, b.radius as appradius , concat(c.starttime, ' - ', c.endtime) as shiftname, a.status
FROM app_users a
INNER JOIN app_location b on a.applocationid=b.applocationid
LEFT JOIN app_location b on a.applocationid=b.applocationid
LEFT JOIN ridershifts c ON a.shiftid = c.shiftid
WHERE a.userid= ?`