返回 AiToEarn
signIn.controller.ts
根目录 / project / aitoearn-electron / server / src / modules / reward / signIn.controller.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-02-15 20:59:55
4 * @LastEditTime: 2025-04-27 18:00:18
5 * @LastEditors: nevin
6 * @Description: signIn SignIn 签到
7 */
8 import { Body, Controller, Get, Post, Query } from '@nestjs/common';
9 import { ApiOperation, ApiTags } from '@nestjs/swagger';
10 import { ApiResult } from '../../common/decorators/api-result.decorator';
11 import { SignInService } from './signIn.service';
12 import { GetToken } from '../../auth/auth.guard';
13 import { TokenInfo } from 'src/auth/interfaces/auth.interfaces';
14 import { CreateSignInDto, QuerySignInListDto } from './dto/signIn.dto';
15 import { SignIn } from 'src/db/schema/signIn.schema';
16
17 @ApiTags('reward/signIn - 奖励/签到')
18 @Controller('reward/signIn')
19 export class SignInController {
20 constructor(private readonly signInService: SignInService) {}
21
22 @ApiOperation({ summary: '创建签到记录' })
23 @Post()
24 @ApiResult({ type: SignIn })
25 async createSignInRecord(
26 @GetToken() token: TokenInfo,
27 @Body() body: CreateSignInDto,
28 ) {
29 const res = await this.signInService.createSignInRecord(
30 token.id,
31 body.type,
32 );
33 return res;
34 }
35
36 @ApiOperation({ summary: '获取时间段内的签到列表' })
37 @Get('list')
38 async getSignInList(
39 @GetToken() token: TokenInfo,
40 @Query() query: QuerySignInListDto,
41 ) {
42 return this.signInService.getSignInList(token.id, query);
43 }
44 }
45
45 lines TYPESCRIPT