Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 7dcdd235

Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)

Added more info to UserInfo return DTO

Zobrazit rozdíly:

Backend/Core/Services/UserService/UserServiceEF.cs
190 190
            foreach (var user in users)
191 191
            {
192 192
                var userInfo = _mapper.Map<UserInfo>(user);
193
                userInfo.AssignedDocumentsCount = _databaseContext.Annotations
193
                var annotations = _databaseContext.Annotations
194 194
                    .Include(a => a.User)
195 195
                    .Where(a => !(a is FinalAnnotation))
196 196
                    .Where(a => a.User == user)
197
                    .Count();
197
                    .ToList();
198
                userInfo.NewDocumentsCount = annotations.Where(a => a.State == EState.NEW).Count();
199
                userInfo.InProgressDocumentsCount = annotations.Where(a => a.State == EState.IN_PROGRESS).Count();
200
                userInfo.FinalizedDocumentsCount = annotations.Where(a => a.State == EState.DONE).Count();
198 201
                userList.Users.Add(userInfo);
199 202
            }
200 203

  
Backend/Models/Users/UserInfo.cs
14 14
        public string Username { get; set; }
15 15
        public string Name { get; set; }
16 16
        public string Surname { get; set; }
17
        public int AssignedDocumentsCount { get; set; }
17
        public int FinalizedDocumentsCount { get; set; }
18
        public int InProgressDocumentsCount { get; set; }
19
        public int NewDocumentsCount { get; set; }
18 20
        public ERole Role { get; set; }
19 21
    }
20 22
}

Také k dispozici: Unified diff