-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: statistics module improvements
- Loading branch information
1 parent
a8e6305
commit 7a5d926
Showing
9 changed files
with
547 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import { Controller, Get } from "@nestjs/common"; | ||
import { Validate } from "nestjs-typebox"; | ||
|
||
import { BaseResponse, UUIDType } from "src/common"; | ||
import { baseResponse, BaseResponse, UUIDType } from "src/common"; | ||
import { CurrentUser } from "src/common/decorators/user.decorator"; | ||
|
||
import { UserStatsSchema } from "../schemas/userStats.schema"; | ||
import { StatisticsService } from "../statistics.service"; | ||
|
||
import type { UserStats } from "../schemas/userStats.schema"; | ||
|
||
@Controller("statistics") | ||
export class StatisticsController { | ||
constructor(private statisticsService: StatisticsService) {} | ||
|
||
@Get() | ||
async getUserStatistics(@CurrentUser("userId") currentUserId: UUIDType) { | ||
@Validate({ | ||
response: baseResponse(UserStatsSchema), | ||
}) | ||
async getUserStatistics( | ||
@CurrentUser("userId") currentUserId: UUIDType, | ||
): Promise<BaseResponse<UserStats>> { | ||
return new BaseResponse(await this.statisticsService.getUserStats(currentUserId)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.