stock request table created
This commit is contained in:
@@ -143,6 +143,19 @@ func (s *userService) AppLogin(user models.User) (models.TenantUserInfo, fiber.M
|
||||
// ✅ Fetch tenant user info
|
||||
info := s.repo.GetTenantUserById(uid)
|
||||
|
||||
// ✅ Check if assigned store is inactive
|
||||
if info.Locationid > 0 {
|
||||
storeStatus := s.repo.GetLocationStatus(info.Locationid)
|
||||
if storeStatus == "InActive" {
|
||||
resp := fiber.Map{
|
||||
"status": false,
|
||||
"code": 403,
|
||||
"message": "Assigned store is inactive. Contact admin.",
|
||||
}
|
||||
return models.TenantUserInfo{}, resp, errors.New("inactive store")
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ Return success response
|
||||
resp := fiber.Map{
|
||||
"status": true,
|
||||
@@ -247,8 +260,6 @@ func (s *userService) TenantWebLogin(user models.User) (models.TenantUserInfo, m
|
||||
}
|
||||
}
|
||||
|
||||
user.Userid = uid
|
||||
|
||||
// Step 4: Update FCM if provided
|
||||
if user.Userfcmtoken != "" {
|
||||
_ = s.repo.UpdateUserFcmToken(uid, user.Userfcmtoken)
|
||||
@@ -257,6 +268,18 @@ func (s *userService) TenantWebLogin(user models.User) (models.TenantUserInfo, m
|
||||
// Step 5: Get full tenant info
|
||||
info := s.repo.GetTenantUserById(uid)
|
||||
|
||||
// Step 6: Check if assigned store is inactive
|
||||
if info.Locationid > 0 {
|
||||
storeStatus := s.repo.GetLocationStatus(info.Locationid)
|
||||
if storeStatus == "InActive" {
|
||||
return models.TenantUserInfo{}, map[string]interface{}{
|
||||
"status": false,
|
||||
"code": 403,
|
||||
"message": "Assigned store is inactive. Contact admin.",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info, map[string]interface{}{
|
||||
"status": true,
|
||||
"code": 200,
|
||||
|
||||
Reference in New Issue
Block a user