File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export class UserDataResponseDto {
66 pollsCreated : number ;
77 pollsParticipated : number ;
88 worldID : string ;
9+ worldProfilePic ?: string | null ;
910}
1011
1112export class GetUserActivitiesDto {
Original file line number Diff line number Diff line change @@ -35,19 +35,28 @@ export class UserService {
3535 async getUserData ( dto : GetUserDataDto ) : Promise < UserDataResponseDto > {
3636 const user = await this . databaseService . user . findUnique ( {
3737 where : { worldID : dto . worldID } ,
38- select : {
39- pollsCreatedCount : true ,
40- pollsParticipatedCount : true ,
41- worldID : true ,
42- } ,
38+ select : { id : true , worldID : true } ,
4339 } ) ;
4440 if ( ! user ) {
4541 throw new Error ( 'User not found' ) ;
4642 }
43+ const pollsCreated = await this . databaseService . userAction . count ( {
44+ where : {
45+ userId : user . id ,
46+ type : ActionType . CREATED ,
47+ } ,
48+ } ) ;
49+ const pollsParticipated = await this . databaseService . userAction . count ( {
50+ where : {
51+ userId : user . id ,
52+ type : ActionType . VOTED ,
53+ } ,
54+ } ) ;
4755 return {
48- pollsCreated : user . pollsCreatedCount ,
49- pollsParticipated : user . pollsParticipatedCount ,
56+ pollsCreated,
57+ pollsParticipated,
5058 worldID : user . worldID ,
59+ worldProfilePic : null ,
5160 } ;
5261 }
5362
You can’t perform that action at this time.
0 commit comments