-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.controller.ts
More file actions
26 lines (21 loc) · 847 Bytes
/
Copy pathbase.controller.ts
File metadata and controls
26 lines (21 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Body, Post, Controller } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ResponseData } from '../../common/interfaces/result.interface';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/create-user.dto';
import { LoginUserDto } from './dto/login-user.dto';
@ApiTags('登录注册')
@Controller()
export class BaseController {
constructor(private readonly userService: UserService) {}
@Post('register')
@ApiOperation({ summary: '用户注册' })
async create(@Body() userData: CreateUserDto): Promise<ResponseData> {
return this.userService.create(userData);
}
@Post('login')
@ApiOperation({ summary: '用户登录' })
async login(@Body() userData: LoginUserDto): Promise<ResponseData> {
return this.userService.login(userData);
}
}