Feature/add activities count to GET user endpoint (#4351)
* Add activities count to GET user endpoint * Update changelog
This commit is contained in:
parent
05b0728b2a
commit
7577a452f0
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Extended the export functionality by the tags
|
- Extended the export functionality by the tags
|
||||||
|
- Extended the user endpoint `GET api/v1/user` by the activities count
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -86,6 +86,9 @@ export class UserService {
|
|||||||
orderBy: { alias: 'asc' },
|
orderBy: { alias: 'asc' },
|
||||||
where: { GranteeUser: { id } }
|
where: { GranteeUser: { id } }
|
||||||
}),
|
}),
|
||||||
|
this.prismaService.order.count({
|
||||||
|
where: { userId: id }
|
||||||
|
}),
|
||||||
this.prismaService.order.findFirst({
|
this.prismaService.order.findFirst({
|
||||||
orderBy: {
|
orderBy: {
|
||||||
date: 'asc'
|
date: 'asc'
|
||||||
@ -96,8 +99,9 @@ export class UserService {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const access = userData[0];
|
const access = userData[0];
|
||||||
const firstActivity = userData[1];
|
const activitiesCount = userData[1];
|
||||||
let tags = userData[2];
|
const firstActivity = userData[2];
|
||||||
|
let tags = userData[3];
|
||||||
|
|
||||||
let systemMessage: SystemMessage;
|
let systemMessage: SystemMessage;
|
||||||
|
|
||||||
@ -117,6 +121,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
activitiesCount,
|
||||||
id,
|
id,
|
||||||
permissions,
|
permissions,
|
||||||
subscription,
|
subscription,
|
||||||
|
@ -10,6 +10,7 @@ import { UserSettings } from './user-settings.interface';
|
|||||||
export interface User {
|
export interface User {
|
||||||
access: Pick<Access, 'alias' | 'id' | 'permissions'>[];
|
access: Pick<Access, 'alias' | 'id' | 'permissions'>[];
|
||||||
accounts: Account[];
|
accounts: Account[];
|
||||||
|
activitiesCount: number;
|
||||||
dateOfFirstActivity: Date;
|
dateOfFirstActivity: Date;
|
||||||
id: string;
|
id: string;
|
||||||
permissions: string[];
|
permissions: string[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user