Feature/add activities count to GET user endpoint (#4351)

* Add activities count to GET user endpoint

* Update changelog
This commit is contained in:
Shaunak Das 2025-02-23 13:20:59 +05:30 committed by GitHub
parent 05b0728b2a
commit 7577a452f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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,

View File

@ -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[];