stores login fix

This commit is contained in:
Suriya
2026-07-09 18:03:44 +05:30
parent 1437a08be5
commit 7e9b3f98ba
9 changed files with 653 additions and 29 deletions

View File

@@ -24,7 +24,7 @@ type TenantService interface {
CreateTenantLocation(data models.Tenantlocations) map[string]interface{}
UpdateTenantLocation(data models.Tenantlocations) map[string]interface{}
CreateTenantUser(data models.Tenants) (models.UserInfo, error)
GetTenantByID(tid int, locationid int) (models.Tenantinfo, error)
GetTenantByID(tid int, locationid int, userid int) (models.Tenantinfo, error)
GetTenantByKeyword(keyword string) ([]models.TenantSearch, error)
}
@@ -158,8 +158,8 @@ func (s *tenantService) CreateTenantUser(data models.Tenants) (models.UserInfo,
return result, nil
}
func (s *tenantService) GetTenantByID(tid int, locationid int) (models.Tenantinfo, error) {
return s.repo.GetTenantByID(tid, locationid)
func (s *tenantService) GetTenantByID(tid int, locationid int, userid int) (models.Tenantinfo, error) {
return s.repo.GetTenantByID(tid, locationid, userid)
}
func (s *tenantService) GetTenantByKeyword(keyword string) ([]models.TenantSearch, error) {

View File

@@ -88,7 +88,7 @@ func (s *userService) AppLogin(user models.User) (models.TenantUserInfo, fiber.M
}
// Inactive account
if status == "InActive" {
if strings.EqualFold(status, "InActive") {
resp := fiber.Map{
"status": false,
"code": 403,
@@ -147,7 +147,7 @@ func (s *userService) AppLogin(user models.User) (models.TenantUserInfo, fiber.M
// ✅ Check if assigned store is inactive
if info.Locationid > 0 {
storeStatus := s.repo.GetLocationStatus(info.Locationid)
if storeStatus == "InActive" {
if strings.EqualFold(storeStatus, "InActive") {
resp := fiber.Map{
"status": false,
"code": 403,
@@ -213,7 +213,7 @@ func (s *userService) TenantWebLogin(user models.User) (models.TenantUserInfo, m
}
}
if status == "InActive" {
if strings.EqualFold(status, "InActive") {
return models.TenantUserInfo{}, map[string]interface{}{
"status": false,
"code": 403,
@@ -272,7 +272,7 @@ func (s *userService) TenantWebLogin(user models.User) (models.TenantUserInfo, m
// Step 6: Check if assigned store is inactive
if info.Locationid > 0 {
storeStatus := s.repo.GetLocationStatus(info.Locationid)
if storeStatus == "InActive" {
if strings.EqualFold(storeStatus, "InActive") {
return models.TenantUserInfo{}, map[string]interface{}{
"status": false,
"code": 403,