feat: 支持获取我创建的分享挑战列表以及详情数据
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Param, Post, UseGuards } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Post, UseGuards } from '@nestjs/common';
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiOperation,
|
||||
@@ -9,6 +9,7 @@ import { ShareService } from './share.service';
|
||||
import { CreateShareDto } from './dto/create-share.dto';
|
||||
import {
|
||||
CreateShareResponseDto,
|
||||
CreatedShareListResponseDto,
|
||||
JoinShareResponseDto,
|
||||
} from './dto/share-response.dto';
|
||||
import { ApiResponseDto } from '../../common/dto/api-response.dto';
|
||||
@@ -23,6 +24,21 @@ import { ReportLevelProgressResponseDto } from './dto/share-level-progress-respo
|
||||
export class ShareController {
|
||||
constructor(private readonly shareService: ShareService) {}
|
||||
|
||||
@Get('created')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({
|
||||
summary: '获取我创建的分享挑战',
|
||||
description: '返回当前用户创建过的分享挑战,并统计参与人数和用户排名',
|
||||
})
|
||||
@ApiResponse({ status: 200, description: '成功' })
|
||||
async getCreatedShares(
|
||||
@CurrentUser() user: JwtPayload,
|
||||
): Promise<ApiResponseDto<CreatedShareListResponseDto>> {
|
||||
const data = await this.shareService.getCreatedShares(user.sub);
|
||||
return ApiResponseDto.success(data);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
|
||||
Reference in New Issue
Block a user