返回 AiToEarn
userConfig.controller.ts
根目录 / project / aitoearn-electron / server / src / user / userConfig.controller.ts
1 /*
2 * @Author: nevin
3 * @Date: 2024-06-17 19:19:20
4 * @LastEditTime: 2025-05-06 15:50:54
5 * @LastEditors: nevin
6 * @Description: 用户设置信息路由 config Config
7 */
8 import { Body, Controller, Put } from '@nestjs/common';
9 import { ApiOperation, ApiTags } from '@nestjs/swagger';
10 import { TokenInfo } from '../auth/interfaces/auth.interfaces';
11 import { ErrHttpBack } from '../filters/http-exception.back-code';
12 import { AppHttpException } from '../filters/http-exception.filter';
13 import { GetToken } from '../auth/auth.guard';
14 import { UserStatus } from 'src/db/schema/user.schema';
15 import { UserConfigService } from './userConfig.service';
16 import { UserService } from './user.service';
17 import { SetUserEarnDto } from './dto/userConfig.dto';
18
19 @ApiTags('用户自定义配置')
20 @Controller('user/config')
21 export class UserConfigController {
22 constructor(
23 private readonly userService: UserService,
24 private readonly userConfigService: UserConfigService,
25 ) {}
26
27 @ApiOperation({
28 summary: '设置自动赚钱配置',
29 })
30 @Put('earn')
31 async setUserEarnInfo(
32 @GetToken() token: TokenInfo,
33 @Body() body: SetUserEarnDto,
34 ) {
35 const res = await this.userConfigService.setUserEarnInfo(token.id, body);
36 return res;
37 }
38 }
39
39 lines TYPESCRIPT