@@ -228,6 +228,7 @@ func (impl AppListingServiceImpl) FetchOverviewAppsByEnvironment(envId, limit, o
228228 resp := & OverviewAppsByEnvironmentBean {}
229229 env , err := impl .environmentRepository .FindById (envId )
230230 if err != nil {
231+ impl .Logger .Errorw ("failed to fetch env" , "err" , err , "envId" , envId )
231232 return resp , err
232233 }
233234 resp .EnvironmentId = envId
@@ -242,18 +243,27 @@ func (impl AppListingServiceImpl) FetchOverviewAppsByEnvironment(envId, limit, o
242243 resp .Type = NonProduction
243244 }
244245 resp .Description = env .Description
245- createdBy , err := impl .userRepository .GetById (env .CreatedBy )
246- if err != nil {
247- return resp , err
246+ createdBy , err := impl .userRepository .GetByIdIncludeDeleted (env .CreatedBy )
247+ if err != nil && err != pg .ErrNoRows {
248+ impl .Logger .Errorw ("error in fetching user for app meta info" , "error" , err , "env.CreatedBy" , env .CreatedBy )
249+ return nil , err
250+ }
251+ if createdBy != nil && createdBy .Id > 0 {
252+ if createdBy .Active {
253+ resp .CreatedBy = fmt .Sprintf (createdBy .EmailId )
254+ } else {
255+ resp .CreatedBy = fmt .Sprintf ("%s (inactive)" , createdBy .EmailId )
256+ }
248257 }
249- resp .CreatedBy = createdBy .EmailId
250258 envContainers , err := impl .appListingRepository .FetchOverviewAppsByEnvironment (envId , limit , offset )
251259 if err != nil {
260+ impl .Logger .Errorw ("failed to fetch environment containers" , "err" , err , "envId" , envId )
252261 return resp , err
253262 }
254263 for _ , envContainer := range envContainers {
255264 lastDeployed , err := impl .appListingRepository .FetchLastDeployedImage (envContainer .AppId , envId )
256265 if err != nil {
266+ impl .Logger .Errorw ("failed to fetch last deployed image" , "err" , err , "appId" , envContainer .AppId , "envId" , envId )
257267 return resp , err
258268 }
259269 if lastDeployed != nil {
0 commit comments