daily merchant app login fix

This commit is contained in:
2026-09-11 11:10:25 +05:30
parent e7577fe0cf
commit 8cc567c89b
4 changed files with 47 additions and 15 deletions

View File

@@ -51,7 +51,28 @@ func (s *userService) TenantLogin(user models.User) (models.TenantUserInfo, erro
return models.TenantUserInfo{}, errors.New("user not found")
}
return s.repo.GetTenantUserByID(uid)
// `GetTenantUserById`, NOT `GetTenantUserByID`.
//
// The two differ by one letter and by twenty-eight columns. The capital-ID
// one selects five — userid, authname, contactno, tenantid, tenantname —
// so this function used to answer with a record whose name, branch, region
// and coordinates were all blank. That is why routing
// `/mob/users/tenant/login` at it was never as simple as swapping the
// handler: the app would have received a mostly-empty object.
//
// The lowercase-d one is the query `AppLogin` and `TenantWebLogin` already
// use, and it fills the whole record. It is now the only one anything calls.
//
// The FCM token is stored here rather than left to the repository, because
// the full read does not write. Only a real token is stored: a login that
// omits it must not wipe the device already registered, which is exactly
// what "userfcmtoken": "your_fcm_token_here" did to a live account during
// this investigation.
if strings.TrimSpace(user.Userfcmtoken) != "" {
_ = s.repo.UpdateUserFcmToken(uid, user.Userfcmtoken)
}
return s.repo.GetTenantUserById(uid), nil
}
func (s *userService) UpdateStaff(user models.User) error {