Browse Source
Feature/add activities count to GET user endpoint (#4351)
* Add activities count to GET user endpoint
* Update changelog
pull/4330/head^2
Shaunak Das
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
9 additions and
2 deletions
-
CHANGELOG.md
-
apps/api/src/app/user/user.service.ts
-
libs/common/src/lib/interfaces/user.interface.ts
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Added |
|
|
|
|
|
|
|
- Extended the export functionality by the tags |
|
|
|
- Extended the user endpoint `GET api/v1/user` by the activities count |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
|
|
@ -86,6 +86,9 @@ export class UserService { |
|
|
|
orderBy: { alias: 'asc' }, |
|
|
|
where: { GranteeUser: { id } } |
|
|
|
}), |
|
|
|
this.prismaService.order.count({ |
|
|
|
where: { userId: id } |
|
|
|
}), |
|
|
|
this.prismaService.order.findFirst({ |
|
|
|
orderBy: { |
|
|
|
date: 'asc' |
|
|
@ -96,8 +99,9 @@ export class UserService { |
|
|
|
]); |
|
|
|
|
|
|
|
const access = userData[0]; |
|
|
|
const firstActivity = userData[1]; |
|
|
|
let tags = userData[2]; |
|
|
|
const activitiesCount = userData[1]; |
|
|
|
const firstActivity = userData[2]; |
|
|
|
let tags = userData[3]; |
|
|
|
|
|
|
|
let systemMessage: SystemMessage; |
|
|
|
|
|
|
@ -117,6 +121,7 @@ export class UserService { |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
activitiesCount, |
|
|
|
id, |
|
|
|
permissions, |
|
|
|
subscription, |
|
|
|
|
|
@ -10,6 +10,7 @@ import { UserSettings } from './user-settings.interface'; |
|
|
|
export interface User { |
|
|
|
access: Pick<Access, 'alias' | 'id' | 'permissions'>[]; |
|
|
|
accounts: Account[]; |
|
|
|
activitiesCount: number; |
|
|
|
dateOfFirstActivity: Date; |
|
|
|
id: string; |
|
|
|
permissions: string[]; |
|
|
|