feat: 支持分享详情接口
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
CreateShareResponseDto,
|
||||
CreatedShareListResponseDto,
|
||||
JoinShareResponseDto,
|
||||
ShareChallengeDetailResponseDto,
|
||||
SubmitShareChallengeResponseDto,
|
||||
} from './dto/share-response.dto';
|
||||
import { ApiResponseDto } from '../../common/dto/api-response.dto';
|
||||
@@ -56,6 +57,27 @@ export class ShareController {
|
||||
return ApiResponseDto.success(data);
|
||||
}
|
||||
|
||||
@Get(':code')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({
|
||||
summary: '获取分享挑战详情',
|
||||
description:
|
||||
'返回分享挑战基本信息,以及所有已提交挑战结果用户的排行榜。排行榜按答对题数降序、总耗时升序排列。',
|
||||
})
|
||||
@ApiResponse({ status: 200, description: '成功' })
|
||||
@ApiResponse({ status: 404, description: '分享不存在' })
|
||||
async getShareChallengeDetail(
|
||||
@CurrentUser() user: JwtPayload,
|
||||
@Param('code') code: string,
|
||||
): Promise<ApiResponseDto<ShareChallengeDetailResponseDto>> {
|
||||
const data = await this.shareService.getShareChallengeDetail(
|
||||
user.sub,
|
||||
code,
|
||||
);
|
||||
return ApiResponseDto.success(data);
|
||||
}
|
||||
|
||||
@Post(':code/join')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
|
||||
Reference in New Issue
Block a user